Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notes/01-singleton-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

### Solution

Singleton pattern is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance. To implement the Singleton patter, the following steps are required:
Singleton pattern is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance. To implement the Singleton pattern, the following steps are required:
* `Constructor hiding` - The constructor of the singleton class should be private or protected. This will prevent other classes from instantiating the singleton class.
* `Global access point` - The singleton class should provide a global access point to get the instance of the singleton class. This global access point should be static and should return the same instance of the singleton class every time it is called. If the instance does not exist, it should create the instance and then return it.

Expand Down Expand Up @@ -266,4 +266,4 @@ Database database = new Database.DatabaseBuilder()

## Reading list
* [Telescoping constructor anti-pattern](https://www.vojtechruzicka.com/avoid-telescoping-constructor-pattern/)
* [Why objects should be immutable?](https://octoperf.com/blog/2016/04/07/why-objects-must-be-immutable)
* [Why objects should be immutable?](https://octoperf.com/blog/2016/04/07/why-objects-must-be-immutable)