What is the difference between a state machine and the implementation of the state pattern?

The way I describe this difference to my colleagues is that state patterns are a more decentralized implementation of many stand alone encapsulated states whereas state machines are more monolithic. The monolithic nature of state machines means that a single state will be harder to reuse in a different machine and that it is harder … Read more

Builder design pattern: Why do we need a Director?

The core portion of the Builder pattern concerns the Abstract Builder and its subclasses (concrete builders). According to GoF’s Design Patterns, director simply “notifies the builder whenever a part of the product should be built”, which can be perfectly done by the client. The StringBuilder class in the Java API is an example of a … Read more

What’s the point of a logging facade? [closed]

I will speak mainly from the perspective of using the abstraction to insulate application code from a particular logging framework. There are other factors that can affect one’s choice of logging framework or one’s choice of (and requirements for) an abstraction. I have spent a lot of time recently evaluating various logging frameworks as well … Read more

What is the design pattern for processing command line arguments

I think the following answer is more along the lines of what you are looking for: You should look at applying the Template Pattern (Template Method in “Design Patterns” [Gamma, el al]) In short it’s overall processing looks like this: If the arguments to the program are valid then Do necessary pre-processing For every line … Read more

What’s the name of Google Analytics async design pattern and where is it used?

I’ve referred to it as “asynchronous function queuing”, but its not quite a catchy name, and certainly not the formal name of the design pattern. What’s interesting is that, though I hadn’t seen this particular pattern used before, since Google adopted it for Google Analytics, its been adopted widely by different platforms looking to nab … Read more