In software development , the design pattern is considered as reusable solution to any common problem statement. It is just like a sample code template that act as a solution.
Design pattern can speed the development process by providing the well structured and tested code samples.It also increases the readability for coders and architects.
2)Prototype Design Pattern : Prototype design pattern is mainly used for creating object where performance matters. Suppose we have done an high level database operation .So, if again we need it at different place , then again we need to use the same operation. So solutions for that is to create a class define all the methods inside it and then create a clone/object for it . Now call all the functions through that object again wherever we require it
3)Observer Design Pattern : In programming architecture , we comes through some of the situations where we need to reflect the change on one part to gets reflected to other parts of the application.For example we use the $scope service in angular1.The observer pattern works in the same manner . when any one object gets changed , it always notify all it’s dependent objects
4)Singleton Design Pattern : The singleton design pattern mainly speaks about the reusability. It restricts the creation of more then one object, after the first object gets created.Like as service in angularjs 1.x follows the singleton design pattern. Once the object gets created , it’s reference gets used at all other places.For example suppose there are 10 peoples in a house.And also there is only one kitchen. then everyone uses the same kitchen for their food requirements.Because there is only one instance of kitchen there . No any other kitchen object created yet
By Pankaj Kumar Agarwal