The Open Close Principle in Programming says “Software entities like Classes, Functions, Modules should be open for extension, but closed for modification.” It encourages programmers to write code in such a way that new functionality can be added without changing the existing code. i.e If we are writing a class, then we may later, extend […]
Singleton patterns are used, when you want to allow creation of only one instance(object) of a particular class. Such classes (which allow only single object to be created) are called Singleton Classes. For example, there is only one Window manager, so a class implementing Windows Manager, should be allowed to be instantiated only once.