当前位置:网站首页>The art of Engineering (3): do not rely on each other between functions of code robustness
The art of Engineering (3): do not rely on each other between functions of code robustness
2022-07-06 17:38:00 【Wzzzzzzx】
My code has three files , One is responsible for producing SVG
character string , One is responsible for storing the string , One responsible for drawing
The code is roughly as follows , And three separate documents
class Producer {
void createSvgString();
...
};
class Storage {
void setSvgStying();
...
};
class Draw {
void drawSvgFigure();
...
};
Now there is a need , I need to judge this SVG
Is the pattern a closed pattern .
At first, in order to avoid modifying too much logic , I'm building SVG
String time , For closed containers , At the end of the string, a Z
ending . Then I just need to draw classes , Judging it can solve the problem .
There is a big problem with this method , It's easy to bury a hole for subsequent developers . The method of determining whether it is a container depends heavily on generating SVG
String function , If you ignore this later , When developing other functions for containers , When something goes wrong , It needs to be in another file , Solve in an irrelevant class .
So the practice here should be to create a function , Used to judge whether it is a container , Then pass the result to the drawing class .
When I work again , Pay attention to one function and concentrate on one job , Don't intersperse the work that other functions should do .
边栏推荐
- 05个人研发的产品及推广-数据同步工具
- 自动答题 之 Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。
- EasyRE WriteUp
- Concept and basic knowledge of network layering
- 【逆向】脱壳后修复IAT并关闭ASLR
- [VNCTF 2022]ezmath wp
- Selenium test of automatic answer runs directly in the browser, just like real users.
- Wordcloud colormap color set and custom colors
- CentOS7上Redis安装
- Akamai talking about risk control principles and Solutions
猜你喜欢
JVM garbage collector part 2
C # nanoframework lighting and key esp32
Flink parsing (IV): recovery mechanism
Vscode matches and replaces the brackets
C version selenium operation chrome full screen mode display (F11)
06 products and promotion developed by individuals - code statistical tools
07个人研发的产品及推广-人力资源信息管理系统
Chrome prompts the solution of "your company management" (the startup page is bound to the company's official website and cannot be modified)
JVM 垃圾回收器之Serial SerialOld ParNew
虚拟机启动提示Probing EDD (edd=off to disable)错误
随机推荐
Quick start of Hongmeng system
vscode
基于LNMP部署flask项目
Huawei certified cloud computing hica
CentOS7上Redis安装
C#WinForm中的dataGridView滚动条定位
TCP connection is more than communicating with TCP protocol
EasyRE WriteUp
【MMdetection】一文解决安装问题
学 SQL 必须了解的 10 个高级概念
Jetpack compose 1.1 release, based on kotlin's Android UI Toolkit
分布式(一致性协议)之领导人选举( DotNext.Net.Cluster 实现Raft 选举 )
Akamai anti confusion
Wordcloud colormap color set and custom colors
当前系统缺少NTFS格式转换器(convert.exe)
PySpark算子处理空间数据全解析(4): 先说说空间运算
[ciscn 2021 South China]rsa writeup
自动化运维利器ansible基础
About selenium starting Chrome browser flash back
Precipitated database operation class - version C (SQL Server)