The Builder pattern is useful for creating complex objects that need step-by-step assembly. Or put more specifically, when a constructor just doesn’t do the trick anymore… Builders are incredibly common and you are already using them. For instance: Builders “chain together” methods and allow you to append method one after…
Iterator Pattern Explained Simply
An iterator is simply an object that is used to traverse a data structure. Unless you are working on an old Java code base, iterator patterns are going to be few and far between. Although rare, many of the features we take for granted exist because of this pattern. It’s…
Factory Pattern Explained Simply
Creational patterns abstract the instantiation process, because sometimes using new is just not cool enough. This is because instantiation can often times lead to coupling problems. Coupling problems are not cool. When you see “new”, think “concrete”. – Head First Java While this is a play on words, it is…
“Program to an interface” Explained Simply
“Programming to an interface” is likely one of the most followed principles in software. Why? Because we use interfaces everywhere in software without really thinking about it. In fact, you can technically program to an interface using an abstract class. Programming to an interface simply means programming to a supertype…