Design Principle vs Design Pattern 设计原则 vs 设计模式
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Design Principle vs Design Pattern 设计原则 vs 设计模式,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1925字,纯文字阅读大概需要3分钟。
内容图文
Design Principle vs Design Pattern
设计原则 vs 设计模式
来源:https://www.tutorialsteacher.com/articles/difference-between-design-principle-and-design-pattern
In software engineering, design principle and design pattern are not the same.
在软件工程中,设计原则和设计模式是不同的。
Design Principle
设计原则
Design principles provide high level guidelines to design better software applications. They do not provide implementation guidelines and are not bound to any programming language. The SOLID (SRP, OCP, LSP, ISP, DIP) principles are one of the most popular sets of design principles.
设计原则为设计更好的软件应用提供更高层次的指导。它们不提供实现指南,也不受任何编程语言的约束。
For example, the Single Responsibility Principle (SRP) suggests that a class should have only one reason to change. This is a 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 up to you how you implement SRP in your application.
例如,单一职责原则(SRP)建议一个类应该只有一个改变的理由。这是我们在程序设计或者创建类时可以记住的高级语句【译者注:个人理解,就是记住SPR原则】。SRP不提供具体的实现步骤,由您决定如何在应用程序中实现SRP。
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.
设计模式提供与实现相关的低层次的解决方案,解决常见的面向对象问题。换句话说,设计模式为特定的面向对象问题提供特定的实现。例如,如果你想创建一个只能有一个对象的类,那么你可以使用单例模式,这是创建一个类只能有一个对象的最佳方式。
Design patterns are tested by others and are safe to follow, e.g. Gang of Four patterns: Abstract Factory, Factory, Singleton, Command, etc.
设计模式由他人测试好了,可以安全的遵循使用。如:四人组的模式,抽象工厂,工厂,单例,命令等等模式。
原文:https://www.cnblogs.com/yejianhui/p/12200060.html
内容总结
以上是互联网集市为您收集整理的Design Principle vs Design Pattern 设计原则 vs 设计模式全部内容,希望文章能够帮你解决Design Principle vs Design Pattern 设计原则 vs 设计模式所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。