An open API service providing repository metadata for many open source software ecosystems.

GitHub / Design-pattrns 1 Repository

Design Patterns are very popular among software developers. A design pattern is a well described solution to a common software problem.

Design-pattrns/Builder-Pattern

Builder pattern was introduced to solve some of the problems with Factory and Abstract Factory design patterns when the Object contains a lot of attributes. There are three major issues with Factory and Abstract Factory design patterns when the Object contains a lot of attributes.

Language: Java - Size: 151 KB - Last synced at: 10 days ago - Pushed at: over 6 years ago - Stars: 4 - Forks: 0

Design-pattrns/Factory-Pattern

Factory design pattern is used when we have a super class with multiple sub-classes and based on input, we need to return one of the sub-class. This pattern take out the responsibility of instantiation of a class from client program to the factory class. We can apply Singleton pattern on Factory class or make the factory method static

Language: Java - Size: 15.6 KB - Last synced at: over 1 year ago - Pushed at: over 6 years ago - Stars: 0 - Forks: 0

Design-pattrns/Adapter-Pattern

Adapter design pattern is one of the structural design pattern and it’s used so that two unrelated interfaces can work together. The object that joins these unrelated interface is called an Adapter.

Language: Java - Size: 109 KB - Last synced at: over 1 year ago - Pushed at: over 6 years ago - Stars: 8 - Forks: 0

Design-pattrns/Prototype-Pattern

Prototype pattern is one of the Creational Design pattern, so it provides a mechanism of object creation. Prototype pattern is used when the Object creation is a costly affair and requires a lot of time and resources and you have a similar object already existing. So this pattern provides a mechanism to copy the original object to a new object and then modify it according to our needs. This pattern uses Java cloning to copy the object.

Language: Java - Size: 152 KB - Last synced at: over 1 year ago - Pushed at: over 6 years ago - Stars: 2 - Forks: 0

Design-pattrns/Abstract-Factory-Pattern

In the Abstract Factory pattern, we get rid of if-else block and have a factory class for each sub-class. Then an Abstract Factory class that will return the sub-class based on the input factory class. At first, it seems confusing but once you see the implementation, it’s really easy to grasp and understand the minor difference between Factory and Abstract Factory pattern.

Language: Java - Size: 43.9 KB - Last synced at: over 1 year ago - Pushed at: over 6 years ago - Stars: 0 - Forks: 1

Design-pattrns/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.

Language: Java - Size: 111 KB - Last synced at: over 1 year ago - Pushed at: over 6 years ago - Stars: 4 - Forks: 0