In the process of system development, or buildingProgramIn the process of development, the traditional software engineering provides a "Waterfall" development process, and in the development of specificCodeThere are also some habits of the process.
For these methods and procedures that have been passed down for a long time, sometimes trying to change the order of them will have some unexpected results.
One: test first
The traditional software engineering coding and testing sequence is: Coding-> testing. Another method mentioned in the book test-driven development is to write the test code first, and then write the code that implements the function based on the test code, that is to say, convert the sequence to: Test-> encoding. In this way, all codes are very purposeful, and the test code is a unit test code that can be executed automatically, future modifications and tests are also very convenient.
2. pseudocode
Generally, our coding habits are to write code first, then comments, or write comments while writing code. But the pseudocode method is: write comments first, and then write code. The comments completed at this time are natural languages that can accurately describe the functions to be implemented. Using these texts can help us sort out our ideas and clarify all the implemented functions, then, based on these annotations, you can complete the actual code work without ignoring the overall process because you pay attention to the implementation Language details.
In short, we cannot think that all the things in textbooks are truth, or there are many things that can be changed. Maybe they are suitable for ourselves.