当前位置:网站首页>. 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
边栏推荐
- NOI OPENJUDGE 1.6(09)
- Implement Gobang with C language
- The picture quality has been improved! LR enhancement details_ Lightroom turns on AI photo detail enhancement: picture clarity increases by 30%
- Zzuli:1054 monkeys eat peaches
- NOI OPENJUDGE 1.5(23)
- retrofit
- Pyqt interface production (login + jump page)
- 5.4-5.5
- tonybot 人形机器人 红外遥控玩法 0630
- C string format (decimal point retention / decimal conversion, etc.)
猜你喜欢
On MEM series functions of C language
Tonybot humanoid robot infrared remote control play 0630
dllexport和dllimport
retrofit
To improve efficiency or increase costs, how should developers understand pair programming?
ASTC texture compression (adaptive scalable texture compression)
C language DUP function
Showmebug entered Tencent conference, opening the era of professional technical interview
零拷贝底层剖析
Adc128s022 ADC Verilog design and Implementation
随机推荐
[combinatorics] permutation and combination (set combination, one-to-one correspondence model analysis example)
Zzuli:1056 lucky numbers
[graphics] efficient target deformation animation based on OpenGL es 3.0
Zzuli: sum of 1051 square roots
QT - draw something else
Zzuli:1054 monkeys eat peaches
Qt development - scrolling digital selector commonly used in embedded system
Container of symfony
Showmebug entered Tencent conference, opening the era of professional technical interview
Niuke bm83 string deformation (case conversion, string inversion, string replacement)
1017 a divided by B (20 points)
tonybot 人形机器人 定距移动 代码编写玩法
556. 下一个更大元素 III : 简单构造模拟题
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
pyQt界面制作(登录+跳转页面)
Tonybot humanoid robot infrared remote control play 0630
Talking about part of data storage in C language
Adobe Premiere Pro 15.4 has been released. It natively supports Apple M1 and adds the function of speech to text
Zzuli: cumulative sum of 1050 factorials
[ue4] HISM large scale vegetation rendering solution