Distinction between design principle and design pattern

Difference between Design Principle and Design Pattern

In the software engineering, design principle and design pattern are not the same.

Design Principle:

It provides high level guide lines to design better software applications. Design principles do not provide implementation and not bound to any programming language. E.g. SOLID (SRP, OCP, LSP, ISP, DIP) principles.
For example, Single Responsibility Principle (SRP) suggests that a class should have only one and one reason to change. This is high level statement which we can keep in mind while designing or creating classes for our application. SRP does not provide specific implementation steps but it's on you how you implement SRP in your application.

Design Pattern:

It provides low level solution (implementation) for the commonly occurring object oriented problem. In another word, design pattern suggest specific implementation for the specific object oriented programming problem. For example, if you want create a class that can only have one object at a time then you can use Singleton design pattern which suggests the best way to create a class that can only have one object.
Design patterns are tested by others and safe to follow. E.g. Gang of Four patterns: Abstract Factory, Factory, Singleton, Command etc.

Comments

Popular posts from this blog

composer installation on aws ec2 instance ami ubuntu 18.04

nginx installation on aws ec2 instance ami ubuntu 18.04

PHP7.3 installation on aws ec2 instance ami ubuntu 18.04