Sunday, December 11, 2016

JAVA Design Patterns

Design patterns are very popular among the software developer. A design pattern is a well described solution to common software problem

Advantages of Software Design patterns :


  • Using design patterns promotes reusability,  that leads to more robust and highly maintainable code. It helps in reducing the total cost of ownership of the software product
  • Since design patterns are already defined, it makes our code easy to understand and debug.
    It leads to faster development and new members of the team to understand easily   

JAVA Design patterns are divided into three categories
  1. Creational Design Patterns: provide solution to instantiate object in the best possible way in specific solutions.
  2. Structural Design Patterns : provide different way to create a class structure for example to using inheritance and composition to create a large object from small object
  3. Behavioral DesignPatterns : provide solution for the better interaction between objects and how to provide lose coupling and flexibility to extend easily.

Singleton Pattern

Singleton pattern restricts the instantiation of a class and ensures that only one instance of the class exists in the java virtual machine. It seems to be a very simple design pattern but when it comes to implementation, it comes with a lot of implementation concerns. The implementation of Singleton pattern has always been a controversial topic among developers. Check out Singleton Design Patternto learn about different ways to implement Singleton pattern and pros and cons of each of the method. This is one of the most discussed java design patterns.

3 comments:

  1. Well explained . Great article on singleton pattern . There is also good singleton pattern example visit Singleton class example   

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete