Saturday, 1 June 2019

Design Principle vs. Design Pattern

Object Oriented Programming
OOP is a programming paradigm that represents concepts as “objects” that have data fields (attributes that describe the object) and associated methods. Objects (instances of classes) are used to interact with one another to design applications and computer programs.

OO basics principles:
Polymorphism
Abstraction
Encapsulation
Inheritance

Design Principles:
Design principles are core abstract principles which we are supposed to follow while designing software architect. Remember they aren't concrete; rather abstract.

OO principle is a set of guidelines that ensures OOP concept. Based on the OOP concept, this defines ways to design a better way, a better design.

Examples:
1. Single Responsibility Principle
2. Open Close Principle
3. Liskov’s Substitution Principle
4. Interface Segregation Principle
5. Dependency Inversion Principle



Design Patterns:
They are solutions to real-world problems that pop up time and again, so instead of reinventing the wheel, we follow the design patterns that are well-proven, tested by others, and safe to follow. Now, design patterns are specific, there are terms and conditions only in which they can be applied.

OO design patterns (OODPs) are those which provide a general solution to object-oriented design based OO principle.

Design patterns are discovered, not invented.

Examples:
Singleton Pattern
Factory pattern.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...