Skip to content

kasodeep/low-level-design

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Pattern:

A Pattern is a solution to a problem in a context.

Strategy Pattern✔:

It defines a family of algorithms(Duck, Fly..) encapsulated each one, and makes them interchangeable.
Strategy lets the algorithm vary independently from client that uses it.

Observer Pattern✔:

It defines a one-to-many dependency between objects so that when one object changes state,
all of its dependents are notified and updated automatically.

Decorator Pattern✔:

It attaches additional responsibilities to an object dynamically.
Decorators provide a flexible alternative to subclassing for extending functionality.
We are adding dynamic behavior to the classes at runtime using composition.

Factory Pattern✔:

It defines an interface for creating an object, but let subclasses decide which class to instantiate.
Factory method lets a class defer instantiation to subclasses.

Abstract Factory✔:

The Abstract Factory Pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.

Singleton Pattern✔:

It ensures a class has only one instance, and provides a global point of access to it.

Command Pattern✔:

It encapsulates a request as an object, thereby letting you parameterize other objects with different requests,
queue or log requests, and support undoable actions.

Adapter Pattern✔:

It converts the interface of a class into another interface the client expects.
Adapter let's classes work together that couldn't otherwise because of incompatible interfaces.

Facade Pattern✔:

It provides a unified interface to a set of interfaces in a subsystem.
Facade defines a higher level interface that makes the subsystem easier to use.

Template Pattern✔:

It defines the skeleton of an algorithm in a method, deferring some steps to subclasses.
Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

Iterator Pattern✔:

It provides a way to access elements of an aggregate object sequentially without exposing its underlying representation.

Composite Pattern✔:

It allows you to compose objects into tree structures to represent part-whole hierarchies.
Composite lets clients treat individual objects and composition of objects uniformly.

The State Pattern✔:

It allows for an object to alter its behavior when its internal state changes.
The object will appear to change its class. 

Bridge Pattern✔:

The Bridge Pattern allows you to vary the implementation and the abstraction by placing the two in separate class hierarchies.

Builder Pattern✔:

Instead of using a telescoping constructor or setting multiple properties, the Builder pattern provides a clear and fluent interface to set up the desired object configuration.

Fly-Weight Pattern✔:

The Flyweight Pattern is a structural design pattern used to minimize memory usage and optimize performance by sharing as much data as possible among similar objects.

Mediator Pattern✔:

The Mediator Pattern is a behavioral design pattern that reduces the complexity of communication between multiple objects by introducing a mediator object.

Memento Pattern✔:

The Memento Pattern is a behavioral design pattern that allows capturing and restoring an object's state without exposing its internal details.

Design Principles:

1. Identify the aspects of your application that vary and separate them from what stays the same.✔
Take the parts that vary and encapsulate them, so that later you can alter or extend the parts that vary without affecting those that don't.

2. Program to an interface, not an implementation.✔
The point is to explore polymorphism, by programming to a super type so that actual runtime object isn't locked into the code.

3. Favor composition over inheritance.✔
The HAS-A relation should be composed, as it allows to change behavior at runtime.

4. Strive for loosely coupled designs between objects that interact✔.
The objects interact without having much knowledge about each other.

4. The Open Closed Principle.✔
Classes should be open for extension and close for modification.

5. Single Responsibility Principle.✔
Classes should be responsible for only one task.

6. Dependency Inversion Principle.✔
Depend upon abstraction, do not depend upon concrete classes.

7. Principle of Least Knowledge.✔
Talk to only your immediate friends.

8. The Hollywood Principle.✔
Don't call us, We will call you!.

Creational Patterns

The patterns involve object instantiation and all provide a way to decouple a client from the objects it needs to instantiate.
Singleton, Builder, Factory (Both), Prototype.

Structural Patterns

It lets you compose classes or objects into into larger structures.
Decorator, Composite, Proxy, Adapter, Facade.

Behavioral Patterns

It is concerned with how classes and objects interact and distribute responsiblity.
Observer, State, Strategy, Command, Iterator, Template Method.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages