Difference between Design Principle and Design Pattern

Difference between Design Principle and Design Pattern

Design principle và design pattern là hai thuật ngữ không giống nhau.

Design Principle:

Nó cung cấp hướng dẫn để thiết kế phần mềm tốt hơn. Design principles không cung cấp việc hiện thực và không ràng buôc với bất kỳ ngôn ngữ nào. Ví dụ nguyên lý SOLID.
Ví dụ , Nguyên lý SRP(Single Responsibility Principle) là một class nên có một lý do để thay đổi . Đây là một phát biểu mà chúng ta phải ghi nhớ trong quá trình thiết kế hoặc tạo class trong ứng dụng . SRP không cung cấp các bước triển khai cụ thể.

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.

Nhận xét

Bài đăng phổ biến từ blog này

Web API : Parameter Binding

Web API Routing

Action Method Return Type