In my previous article, I spoke about the factory patterns. These patterns are part of creational patterns. In this post we’ll focus on the rest of the creational patterns: the Singleton, the Builder and the prototype.
In this in-depth article I present the advantages and drawbacks of factories. Then I present each type with real examples from famous Java frameworks or Java APIs. I use Java code to implement factories but if you don’t know Java you’ll still be able to understand the idea. I also use UML to present each pattern.
As a java developper, I’ve never heard of the LSP pattern. It was only when I read some stuff about C++ that I encountered this pattern. It’s very strange because this pattern is sometimes seen as one of the 5 principles of object-oriented programming.