Submitted by heartin on Tue, 01/22/2013 - 00:12
The singleton pattern is a design pattern that restricts the instantiation of a class to one object. At a given point of time there should be only one instance of the given class. We won’t cover every possible ways to do singleton, but only some solutions which I feel is important. We will start with a small introduction to design patterns and then see what a singleton pattern is and how it can be implemented effectively in Java.
Submitted by heartin on Sat, 09/05/2015 - 22:14
SOLID is a mnemonic acronym introduced by Michael Feathers for five of the principles named by Robert C. Martin, and when applied together, these intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.
(++) Single responsibility principle (SRP)
Submitted by heartin on Sun, 03/22/2015 - 19:42
There is a saying that a picture can speak thousand words. UML diagrams are those pictures which can speak all those words about your design. There are many categories of UML diagrams. However this note will contain only those class diagram components that are really required for representing your design decisions, design patterns and principles.
Submitted by heartin on Tue, 03/17/2015 - 13:57
Observer pattern is a behavioral design pattern where a collection of objects called observers listens for the state change of another object called subject. Observer pattern defines a one-to-many relationship between the subject and one or more of observers. The subject object maintains a list of its observer objects, and notifies those observers automatically if there are any state changes for the subject, usually by calling one method of the observer.
Submitted by heartin on Thu, 03/12/2015 - 18:04
The strategy pattern is a behavioral pattern that defines a family of algorithms, encapsulates each one of them and makes them interchangeable. According to this pattern, a different class is created for each interchangeable algorithm, and this class can be injected anytime, even at runtime.
Components and working of Strategy Pattern
Important components of strategy pattern are:
Submitted by heartin on Tue, 03/10/2015 - 22:19
There are different types of factory patterns like Simple Factory (Or Class Factory), Factory Method, Abstract Factory Method and Creator Method (Or Static Factory Method). Out of these, Factory Method and Abstract Factory Method are part of the GoF Design Patterns. All factory design patterns help you create objects without using the new keyword directly within your code. Concept is similar to any other real world factories: You use cars, but you don’t develop cars by your own.
Submitted by heartin on Mon, 03/09/2015 - 11:23
Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides; and together they are called the "Gang of Four" or "GoF".
The GOF design patterns can be broadly classified into the following three categories:
Submitted by heartin on Sat, 02/07/2015 - 09:20
Object Oriented Design principles are very important and are sometimes considered even more important than design patterns. All design patterns are based on one or more of the design principles. Having thorough understanding of the design principles will help you understand the design paterns better and faster, and will even help you solve many design scenarios if you can't find a design pattern fitting that scenario.
Submitted by heartin on Sat, 01/25/2014 - 20:53
Factory pattern is a design pattern used to create objects. Similar to a car factory that creates different models of cars, an object factory will create different type of objects. The abstract factory pattern provides a way to encapsulate a group of similar or related factories. Hence the abstract factory can be considered as a factory of factories.
Submitted by heartin on Sat, 01/25/2014 - 06:19
A pattern is a general reusable solution to a commonly occuring problem. Different types of patterns in software engineering include Architectural Patterns, Design Patterns, Idioms etc.
Architectural patterns specify the system-wide structural properties of an application, and have an impact on architecture of its subsystems. The Model-View-Controller pattern is one of the best-known examples of an architectural pattern.