当前位置:网站首页>. 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
边栏推荐
- Adobe Premiere Pro 15.4 has been released. It natively supports Apple M1 and adds the function of speech to text
- My QT learning path -- how qdatetimeedit is empty
- [ue4] geometry drawing pipeline
- tonybot 人形机器人 定距移动 代码编写玩法
- 链表有环,快慢指针走3步可以吗
- Get permissions dynamically
- [graphics] efficient target deformation animation based on OpenGL es 3.0
- Implement Gobang with C language
- Awvs batch operation script
- Code writing and playing method of tonybot humanoid robot at fixed distance
猜你喜欢
Detailed explanation of four modes of distributed transaction (Seata)
5.2-5.3
Paper sharing: generating playful palettes from images
Vs+qt multithreading implementation -- run and movetothread
远程服务器后台挂起 nohup
[graphics] efficient target deformation animation based on OpenGL es 3.0
pyQt界面制作(登录+跳转页面)
adc128s022 ADC verilog设计实现
QT program font becomes larger on computers with different resolutions, overflowing controls
Solve the problem that PR cannot be installed on win10 system. Pr2021 version -premiere Pro 2021 official Chinese version installation tutorial
随机推荐
Zzuli:1055 rabbit reproduction
C language STR function
C language to implement a password manager (under update)
Zzuli:1056 lucky numbers
On MEM series functions of C language
[opengl] pre bake using computational shaders
Container of symfony
My QT learning path -- how qdatetimeedit is empty
7-9 one way in, two ways out (25 points)
Amazon, express, lazada, shopee, eBay, wish, Wal Mart, Alibaba international, meikeduo and other cross-border e-commerce platforms evaluate how Ziyang account can seize traffic by using products in th
Tensor 省略号(三个点)切片
FPGA blocking assignment and non blocking assignment
Detailed explanation of four modes of distributed transaction (Seata)
7-1 positive integer a+b (15 points)
Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution
Awvs batch operation script
Puzzle (016.3) is inextricably linked
【微信小程序】WXSS 模板样式
[engine development] in depth GPU and rendering optimization (basic)
406. 根据身高重建队列