当前位置:网站首页>. 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
边栏推荐
- FPGA blocking assignment and non blocking assignment
- tonybot 人形機器人 紅外遙控玩法 0630
- dllexport和dllimport
- 4-29——4.32
- [opengl] pre bake using computational shaders
- [ue4] material and shader permutation
- Zzuli:1044 failure rate
- My QT learning path -- how qdatetimeedit is empty
- pyQt界面制作(登录+跳转页面)
- The latest M1 dedicated Au update Adobe audit CC 2021 Chinese direct installation version has solved the problems of M1 installation without flash back!
猜你喜欢

零拷贝底层剖析
![Luogu p4047 [jsoi2010] tribal division solution](/img/7f/3fab3e94abef3da1f5652db35361df.png)
Luogu p4047 [jsoi2010] tribal division solution

C language DUP function

5.4-5.5

Tonybot humanoid robot checks the port and corresponds to port 0701

Qt—绘制其他东西

Open under vs2019 UI file QT designer flash back problem

How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03

Detailed explanation of four modes of distributed transaction (Seata)

Code writing and playing method of tonybot humanoid robot at fixed distance
随机推荐
Niuke bm83 string deformation (case conversion, string inversion, string replacement)
Adc128s022 ADC Verilog design and Implementation
Zzuli:1046 product of odd numbers
Code writing and playing method of tonybot humanoid robot at fixed distance
QT program font becomes larger on computers with different resolutions, overflowing controls
pyQt界面制作(登录+跳转页面)
Open under vs2019 UI file QT designer flash back problem
QT - draw something else
C language to realize mine sweeping
Bucket sorting in C language
Vs+qt application development, set software icon icon
cpu飙升排查方法
Zzuli:1044 failure rate
.NET六大设计原则个人白话理解,有误请大神指正
Piwigo 2.7.1 sqli learning
Yolov5进阶之八 高低版本格式转换问题
Paper sharing: generating playful palettes from images
C language dup2 function
Special research report on the market of lithium battery electrolyte industry in China (2022 Edition)
表单文本框的使用(一) 选择文本