Design Mode 0-getting started
When the code is too large, it will inevitably lead to maintenance difficulties if the design is poor and the layers are chaotic.
Ref
Ref
Emotion:
The task assigned to me by the senior engineer is to write the log system.
My step is to design the content to be written, and then get it directly in the simplest way.
Result:
1. The Code style is too bad (mainly hierarchical disorder)
2. Data Storage is messy. Some constant settings/configuration items are not written in the place or in the program code.
I deeply understand the importance of design!
Therefore, you must consider the following points during design:
To obtain data, you need to find out which layers of data can be used to obtain a function. at the interface level, you need to provide function modules for the data layer of upper-layer applications. Data storage. The Context is generally a set of Constants related to configuration items and program running (autoconfig configuration item injection or configuration settings in xml.
PS:
Some Understandings
1. Decoupling: reduce the mutual dependency between classes, similar to int a = B, rather than int a = 2;
Replace them with the intermediate quantity, which is equivalent to the same interface. In this way, B can be changed when we use.