A Technology Blog About Code Development, Architecture, Operating System, Hardware, Tips and Tutorials for Developers.

Monday, September 17, 2012

JAVA DESIGN PATTERNS - Behavioral Patterns

12:48:00 PM Posted by Satish No comments

Behavioral patterns are those which are concerned with interactions between the objects. The interactions between the objects should be such that they are talking to each other and still are loosely coupled. The loose coupling is the key to n-tier architectures. In this, the implementation and the client should be loosely coupled in order to avoid hard-coding and dependencies.

The behavioral patterns are:

Patterns.
1. Chain of Resposibility Pattern
2. Command Pattern
3. Interpreter Pattern
4. Iterator Pattern
5. Mediator Pattern
6. Momento Pattern
7. Observer Pattern
8. State Pattern
9. Strategy Pattern
10. Template Pattern
11. Visitor Pattern

JAVA DESIGN PATTERNS - Structural Patterns

12:46:00 PM Posted by Satish No comments

Structural Patterns describe how objects and classes can be combined to form larger structures. The difference between class patterns and object patterns is that class patterns describe abstraction with the help of inheritance and how it can be used to provide more useful program interface. Object patterns, on other hand, describe how objects can be associated and composed to form larger, more complex structures.

There are seven structural patterns described. They are as follows:

Patterns.
1. Adapter Pattern
2. Bridge Pattern
3. Composite Pattern
4. Decorator Pattern
5. Facade Pattern
6. Flyweight Pattern
7. Proxy Pattern

JAVA DESIGN PATTERNS - Creational Patterns

12:41:00 PM Posted by Satish No comments

All the creational patterns define the best possible way in which an object can be instantiated. Now everyone knows the object instance in Java can be created using a new operator.

Book book = new Book ();

So, what’s the great stuff? Well, that’s true. The new Operator creates the instance of an object, but this is hard-coding. Also, at times the very nature of the object which is created can change according to the nature of the program. In such scenarios, we can make use of patterns to give this a more general and flexible approach.

There are five types of Creational Patterns.
1. Factory Pattern
2. Abstract Factory Pattern
3. Builder Pattern
4. Prototype Pattern
5. Singleton Pattern

I'll be explaining each in detail.

JAVA DESIGN PATTERNS

12:41:00 PM Posted by Satish No comments

According to commonly known practices, there are 23 design patterns in Java. These patterns are grouped under three heads:

1. Creational Patterns

2. Structural Patterns

3. Behavioral Patterns