Home » Tag Archives: Design Patterns (page 9)

Tag Archives: Design Patterns

The Visitor Pattern Re-visited

java-logo

The visitor pattern is one of the most overrated and yet underestimated patterns in object-oriented design. Overrated, because it is often chosen too quickly (possibly by an architecture astronaut), and then bloats an otherwise very simple design, when added in the wrong way. Underestimated, because it can be very powerful, if you don’t follow the school-book example. Let’s have a ...

Read More »

Implementing the State Machine Pattern as a Stream Processor

java-logo

In my last blog, I said that I really thought that some of the Gang Of Four (GOF) patterns were becoming somewhat obsolete, and if not obsolete then certainly unpopular. In particular I said that StateMachine wasn’t that useful as you can usually think of another, simpler way of doing whatever it is you’re doing rather than using it. In ...

Read More »

Java EE Revisits Design Patterns: Observer

java-logo

Aside from being implemented in many languages and many applications, Observer Pattern has been a part of Java since version 1.0. Observer Pattern is also a good implementation of Hollywood Principle. Just like Agents in Hollywood like to callback the candidates for a role instead of being called daily to be asked about available jobs, most of the server side ...

Read More »

The Strategy Pattern

java-interview-questions-answers

In a recent blog on I received a comment from Wojciech Soczy?ski about how the “strategy” pattern can be used to enforce the Single Responsibility Principle (SRP) when using Tell Don’t Ask (TDA). At some point I plan to discuss this further, but first thought that it would be a good idea to define the Strategy Pattern using the ShoppingCart ...

Read More »

Java EE Revisits Design Patterns: Asynchronous

java-logo

Although you may not find Asynchronous method calls listed as a design pattern, I find it worth to mention. So here comes the last post of my JavaEE Revisits Design Patterns series. Asynchronous method calls is not much more than multithreading. Basically it refers to a a method call which would run in a separate thread, thus the main (caller) ...

Read More »

Concurrency Pattern: Producer and Consumer

java-interview-questions-answers

In my career spanning 15 years, the problem of Producer and Consumer is one that I have come across only a few times. In most programming cases, what we are doing is performing functions in a synchronous fashion where the JVM or the web container handles the complexities of multi-threading on its own. However, when writing certain kinds of use ...

Read More »

GWT MVP made simple

google-gwt-logo

GWT Model-View-Presenter is a design pattern for large scale application development. Being derived from MVC, it divides between view and logic and helps to create well-structured, easily testable code. To help lazy developers like me, I investigate how to reduce the amount of classes and interfaces to write when using declarative UIs. Classic MVP You know how to post a ...

Read More »

The Wizard Design Pattern

java-logo

We all love wizards…. (Software wizards I mean). We are always happy to jump on those ”Next” buttons like we were dancing the funky chicken on our… well you get the point. So today we bring you your beloved wizard into your coding experience. Let’s jump right into an example. Say you want to design a ConservativePerson class. import java.util.List; ...

Read More »

Musing on mis-usings: ‘Powerful use, Damaging misuse’

java-logo

There’s an old phrase attributed to the former British Prime Minister Benjamin Disraeli which states there are three types of lies: “lies, damn lies and statistics”.  The insinuation here is that statistics are so easy to make up they are unreliable.  However, statistics are extensively used in empiracle science so surely they have some merit? In fact, they have a ...

Read More »

Programming antipatterns

java-logo

  Did you ever do a code review where you recorded an extremely high amount of WTF/m? And did you ever wonder what the cause of all this bad code is? Most of the time cause number 1 are the use of design and coding antipatterns. If you like definitions, here is one: An AntiPattern is a literary form that ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close