SOLID

In software engineering, SOLID is a mnemonic acronym for five design principles intended to make object-oriented designs more understandable, flexible, and maintainable.

The SOLID ideas are

The single-responsibility principle: "There should never be more than one reason for a class to change." In other words, every class should have only one responsibility.

The open–closed principle: "Software entities ... should be open for extension, but closed for modification."

The Liskov substitution principle: "Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it." See also design by contract.

The interface segregation principle: "Many client-specific interfaces are better than one general-purpose interface."

The dependency inversion principle: "Depend upon abstractions, [not] concretions."

理解

上面摘自维基百科,一句概括:SOLID是面向对象设计的五个原则,另软件更易理解,更灵活可维护。而在《架构简洁之道》中,作者展开并讨论了SOLID对于架构设计上的重要价值。很容易理解,架构设计中的组件、子系统,可以看做各种通过网络组织起来的对象,SOLID原则同样可以提高架构的可理解性,灵活性,可维护性。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容