当前位置:网站首页>. 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
边栏推荐
- China PETG market forecast and Strategic Research Report (2022 Edition)
- Several sentences extracted from the book "leather bag"
- Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution
- Showmebug entered Tencent conference, opening the era of professional technical interview
- Luogu p5536 [xr-3] core city solution
- tonybot 人形机器人 查看端口并对应端口 0701
- Zzuli:1046 product of odd numbers
- [opengl] pre bake using computational shaders
- Luogu p3065 [usaco12dec]first! G problem solution
- Find books ()
猜你喜欢

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

C # realizes the login interface, and the password asterisk is displayed (hide the input password)

Paper sharing: generating playful palettes from images

Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in

pyQt界面制作(登录+跳转页面)

Adc128s022 ADC Verilog design and Implementation

Vs+qt application development, set software icon icon

C language to realize mine sweeping
![[ue4] cascading shadow CSM](/img/83/f4dfda3bd5ba0172676c450ba7693b.jpg)
[ue4] cascading shadow CSM

Devaxpress: range selection control rangecontrol uses
随机推荐
tonybot 人形机器人 定距移动 代码编写玩法
FPGA blocking assignment and non blocking assignment
My QT learning path -- how qdatetimeedit is empty
Detailed explanation of four modes of distributed transaction (Seata)
Piwigo 2.7.1 sqli learning
Plane vector addition
Zzuli:1045 numerical statistics
[ue4] cascading shadow CSM
4-29——4.32
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
Detailed explanation of four modes of distributed transaction (Seata)
复合类型(自定义类型)
从书本《皮囊》摘录的几个句子
[opengl] advanced chapter of texture - principle of flowmap
556. 下一个更大元素 III : 简单构造模拟题
Yolov5进阶之七目标追踪最新环境搭建(二)
Get permissions dynamically
How to color ordinary landscape photos, PS tutorial
Qt—绘制其他东西
[combinatorics] permutation and combination (set combination, one-to-one correspondence model analysis example)