当前位置:网站首页>. Net six design principles personal vernacular understanding, please correct if there is any error
. Net six design principles personal vernacular understanding, please correct if there is any error
2022-07-03 14:52:00 【Xu Ziqian】
Opening and closing principle : On the extension , Close... To modification , Interface is a good example , It can be extended on the basis of the source code , But you can't change the source code
A single principle : Single function , A class represents a function .
The Ritchie principle : Subclasses can be used as parent classes , Subclasses need to inherit all methods of the parent class
The principle of Dependence Inversion : Rely on abstract interfaces , Don't rely on concrete implementation , Try to use interfaces to encapsulate common ground
Interface isolation principle : Split bloated interfaces into smaller and more specific interfaces , It is not a method with high commonality that is pulled out and encapsulated into an interface ,
You need to use the methods in the new interface to inherit the new interface , If you put many subclasses in an interface, you don't need some methods inside , It seems that this interface is relatively bloated ,
Don't put all methods into the same interface in order to save trouble .
Dimitar's law : Reduce coupling between classes . Each class minimizes dependencies on other classes , Make the function module function as independent as possible . For example, you need to pass the class 1 Display methods display classes 1 And the class 2 The data of
Don't be in class 1 Write the display class directly in 2 Logical code of , But in class 2 Finish writing the display class 2 Methods , Then it is passed to the class in the form of parameters 1 The presentation method of a class 2 The object of ,
Then call class 2 How to show
边栏推荐
- QT - draw something else
- The latest M1 dedicated Au update Adobe audit CC 2021 Chinese direct installation version has solved the problems of M1 installation without flash back!
- Pyqt interface production (login + jump page)
- My QT learning path -- how qdatetimeedit is empty
- 406. 根据身高重建队列
- Zzuli:1058 solving inequalities
- [graphics] efficient target deformation animation based on OpenGL es 3.0
- C language DUP function
- Qt development - scrolling digital selector commonly used in embedded system
- Zzuli:1045 numerical statistics
猜你喜欢

dllexport和dllimport

CentOS7部署哨兵Redis(带架构图,清晰易懂)

Tonybot Humanoïde Robot Infrared Remote play 0630

retrofit

C language fcntl function

Tonybot humanoid robot starts for the first time 0630

Zzuli:1053 sine function

QT program font becomes larger on computers with different resolutions, overflowing controls

ASTC texture compression (adaptive scalable texture compression)

Bucket sorting in C language
随机推荐
Analysis of gene family characteristics - chromosome location analysis
Open under vs2019 UI file QT designer flash back problem
Creation of data table of Doris' learning notes
4-20-4-23 concurrent server, TCP state transition;
Get permissions dynamically
tonybot 人形机器人 红外遥控玩法 0630
CentOS7部署哨兵Redis(带架构图,清晰易懂)
Paper sharing: generating playful palettes from images
406. 根据身高重建队列
[opengl] face pinching system
Adc128s022 ADC Verilog design and Implementation
Zzuli:1048 factorial table
Common shortcut keys in PCB
Dllexport and dllimport
Zzuli:1053 sine function
【7.3】146. LRU caching mechanism
[ue4] cascading shadow CSM
B2020 分糖果
Table of mathematical constants by q779
亚马逊、速卖通、Lazada、Shopee、eBay、wish、沃尔玛、阿里国际、美客多等跨境电商平台,测评自养号该如何利用产品上新期抓住流量?