Design Principle (0): Design Principle vs Design Pattern

Note: this article is published on 06/24/2024

This series of articles will discuss Software Design Principles.

In software engineering, design principles and design patterns are not the same.

Design Principle

Design principles provide high-level guidelines for designing better software applications. They do not provide implementation guidelines and are not bound to any programming language. Such as SOLID

SOLID is a mnemonic acronym, and each of the letters in it stands for:

For example, the Single Responsibility Principle (SRP) suggests that a class should have only one reason to change. This is a high-level statement that we can keep in mind while designing or creating classes for our application. SRP does not provide specific implementation steps, but it's up to you how you implement SRP in your application.

Another set of Design Principles from Microsoft: Architectural principles

  • Separation of concerns
  • Encapsulation
  • Dependency inversion
  • Explicit dependencies
  • Single Responsibility
  • Don't repeat yourself (DRY)
  • Persistence ignorance
  • Bounded contexts

More from Principles | DevIQ

Design Pattern

Design Pattern provides low-level solutions related to implementation, of commonly occurring object-oriented problems. In other words, design pattern suggests a specific implementation for the specific object-oriented programming problem.

For example, if you want to create a class that can only have one object at a time, then you can use the Singleton design pattern which suggests the best way to create a class that can only have one object.

Others, such as

  • MVC Pattern
  • MVVM Pattern
  • Dependency Injection Pattern
  • Disposal Pattern

and Gang of Four Design Patterns.

Design patterns are tested by others and are safe to follow, e.g. Gang of Four patterns: Abstract Factory, Factory, Singleton, Command, etc.

References: