Passing single object vs. passing multiple parameters

Method A (naked parameters) always has the advantages that it requires the method author to type less, since they don’t have to implement a Parameter Object, it requires the method caller to type less, since they don’t have to instantiate a Parameter Object it performs better, since no Parameter Object has to be constructed and … Read more

Real world examples of Factory Method pattern

A class implementing factory design pattern works as bridge between multiple classes. Consider an example of using multiple database servers like SQL Server and Oracle. If you are developing an application using SQL Server database as backend, but in future need to change backend database to oracle, you will need to modify all your code, … Read more

Difference between Structural Design Pattern and Behavioral Design Pattern? [closed]

Best way to explain would be to take two examples from two categories. Composite from Structural patterns defines a tree like structure, so focuses on the relationship. One to many and has a type of relationships so that whole and part can be treated alike. Observer pattern on the other hand from Behavioral design patterns … Read more

Design patterns for functional-OO hybrid languages?

Two patterns from Bill Venners; I think both are heavily used in ScalaTest: Stackable Trait (similar in structure to the decorator pattern, except it involves decoration for the purpose of class composition instead of object composition). Selfless Trait (allows library designers to provide services that their clients can access either through mixins or imports). Type … Read more

Functional equivalent of decorator pattern?

In functional programming, you would wrap a given function in a new function. To give a contrived Clojure example similar to the one quoted in your question: My original drawing function: (defn draw [& args] ; do some stuff ) My function wrappers: ; Add horizontal scrollbar (defn add-horizontal-scrollbar [draw-fn] (fn [& args] (draw-horizontal-scrollbar) (apply … Read more

What is the difference between a channel adapter and a messaging gateway pattern?

That’s a great question since they are similar in that they provide an application access to a messaging system. It is how they acheive it I think that differentiates them. The Channel Adapter pattern deals how to get data from an existing system without modifying that system. Typically the Channel Adapdter is implemented out-of-process. Examples … Read more