What is the exact difference between Adapter and Proxy patterns?

From here: Adapter provides a different interface to its subject. Proxy provides the same interface. You might think of an Adapter as something that should make one thing fit to another that is incompatible if connected directly. When you travel abroad, for example, and need an electrical outlet adapter. Now a Proxy is an object … Read more

Is This Use of the “instanceof” Operator Considered Bad Design?

The Visitor pattern is typically used in such cases. Although the code is a bit more complicated, but after adding a new RecordType subclass you have to implement the logic everywhere, as it won’t compile otherwise. With instanceof all over the place it is very easy to miss one or two places. Example: public abstract … Read more

“Hello World” in MVC Pattern

var M = {}, V = {}, C = {}; M.data = “hello world”; V.render = function (M) { alert(M.data); } C.handleOnload = function () { V.render(M); } window.onload = C.handleOnLoad; Controller (C) listens on some kind of interaction/event stream. In this case it’s the page’s loading event. Model (M) is an abstraction of a … Read more

Resources to learn solving system design interview problems [closed]

I found this answer in Quora which has some very useful documents, videos and articles. Both answers are really good: http://www.quora.com/Job-Interviews/How-should-I-prepare-system-design-questions-for-Google-Facebook-Interview Also: How to Rock a Systems Design Interview How do I design an arbitrary system in an interview? System design – This is a very complete step-by-step guide/tutorial System Design Tutorials – A collection … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)