当前位置:网站首页>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 .
边栏推荐
- C version selenium operation chrome full screen mode display (F11)
- Final review of information and network security (based on the key points given by the teacher)
- 【ASM】字节码操作 ClassWriter 类介绍与使用
- MySQL Advanced (index, view, stored procedures, functions, Change password)
- 灵活报表v1.0(简单版)
- Virtual machine startup prompt probing EDD (edd=off to disable) error
- Kali2021 installation and basic configuration
- Xin'an Second Edition: Chapter 25 mobile application security requirements analysis and security protection engineering learning notes
- MySQL advanced (index, view, stored procedure, function, password modification)
- 远程代码执行渗透测试——B模块测试
猜你喜欢
[elastic] elastic lacks xpack and cannot create template unknown setting index lifecycle. name index. lifecycle. rollover_ alias
Flink parsing (VII): time window
【Elastic】Elastic缺少xpack无法创建模板 unknown setting index.lifecycle.name index.lifecycle.rollover_alias
The NTFS format converter (convert.exe) is missing from the current system
[reverse primary] Unique
【逆向中级】跃跃欲试
07个人研发的产品及推广-人力资源信息管理系统
Display picture of DataGridView cell in C WinForm
1. Introduction to JVM
Vscode replaces commas, or specific characters with newlines
随机推荐
自动答题 之 Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。
连接局域网MySql
05 personal R & D products and promotion - data synchronization tool
The solution to the left-right sliding conflict caused by nesting Baidu MapView in the fragment of viewpager
远程代码执行渗透测试——B模块测试
PySpark算子处理空间数据全解析(5): 如何在PySpark里面使用空间运算接口
Chrome prompts the solution of "your company management" (the startup page is bound to the company's official website and cannot be modified)
connection reset by peer
Uipath browser performs actions in the new tab
[elastic] elastic lacks xpack and cannot create template unknown setting index lifecycle. name index. lifecycle. rollover_ alias
【逆向中级】跃跃欲试
03 products and promotion developed by individuals - plan service configurator v3.0
Vscode replaces commas, or specific characters with newlines
Essai de pénétration du Code à distance - essai du module b
【MySQL入门】第四话 · 和kiko一起探索MySQL中的运算符
EasyRE WriteUp
微信防撤回是怎么实现的?
当前系统缺少NTFS格式转换器(convert.exe)
mysql的列的数据类型详解
Example of batch update statement combining update and inner join in SQL Server