Skip to content

Inferno-P/DesignPatterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pre-Requisites: Understanding of Object Oriented concepts like Abstraction, Inheritance, Polyorphism and Encapsulation. Knowledge of classes, Interfaces and Abstract classes will be very helpful.

Design Patterns

Design Patterns are evolved as reusable soltions to the problems that we encounter every day of programming. Genereally, tey are targeted at solving the problems of object generation and integration. These generalized patterns act as templates that can be applied to the real-world problems.

Types of Design Patterns

Creational

This type deals with the object creation and intialization. Thsi pattern gives the program more flexibility in deciding whihc objects need to be created for a given case.

Example - Singleton, Factory, Abstract Factory, etc.

Structural

This type deals with class and object compostion. This pattern focuses on decoupling interface and implementation of classes and it's objects.

Example - Adapter, Bridge,etc.

Behavioural

This type deals with the communication between classes and objects.

Example - Chain of Responsibility, Command, Interpreter, etc.

Let's explore some Design Patterns....

Singleton

This pattern restricts the instantiation of a class to one object. It is a type of creational pattern and involves only one class to create methods and specified objects.

Example - In real world, a good example of Singleton pattern would be The President of a nation. Since a nation can have ONLY ONE president, anytime someone calls/invokes/addresses the 'President' only ONE AND THE SAME guy should show up that is appointed as the president.

In simple words, Singleton limits the creation of a class to only one object. Why? Maybe you might need only one instance of a class to co-ordinate actions across the system.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages