惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - 木乃伊人

VS Code 搭建LangChain开发环境 VSCode Unable to import XXX 问题解决记录 大模型应用开发-聊天机器人-保存聊天记录 try-catch中的throw和throw ex的区别 TDD Google Chrome 默认非安全端口列表 EF Core的预先加载、延迟加载、实体追踪 同步、异步、回调 UML类图 Seq Serilog 多线程整理 Vuex和Pinia Vue3+TS+Vite+pinia 枚举 Vite创建Vue3项目 闭包 IdentitySrever4 ElasticSearch 前端防止重复提交案例
软件设计原则
木乃伊人 · 2024-06-20 · via 博客园 - 木乃伊人

一、分类

       六大软件设计原则:单一职责原则、里式替换原则、依赖倒置原则、接口隔离原则、迪米特法则、开闭原则。

二、单一职责原则

       一个类或者一个模块只负责一个功能。

三、里式替换原则

       针对继承而言的。子类可以扩展父类的方法,但不能改变父类原有的方法。另外,里式替换原则,最重要的就是多用组合,少用继承。就是多用private A a;

四、依赖倒置原则

        高层模块依赖于接口,而不是具体的实现,底层模块去实现接口。当需要修改是,我们只针对具体的实现去修改。即面向接口编程。

五、接口隔离原则

        建立单一的接口,不要奖励臃肿庞大的接口,接口尽量细化。

六、迪米特法则

        一个类要让其调用的类知道的最少,无论内部如何复杂只是自己的事儿,与其他类无关。

七、开闭环原则

        对修改关闭,对扩展开放。