WriteCodeTo compile the Web ApplicationProgramIn terms of web form programs, the most difficult problem encountered is the investigation and positioning of program bugs and the investigation of potential program code vulnerabilities. For friends who have just begun coding, these two points may be both important, but still cannot be started.
When I first joined the company, I was arranged to add logs to a project of the company. Maybe you will wonder why the functional structure of the program is basically complete. However, is the log function for the program delayed? Is this post-event log filling method an efficient and correct way of thinking? At that time, I did not think so much, so I began to go deep into the program code. The original intention was to record every large function (of course, when an error occurred ), at that time, I had a relatively "Naive" method: all the calls to these functions fill the log, and the desired effect is that, in the event of an error, you can quickly learn from the log that the function has encountered an error and records information such as the class and name of the function. The purpose is clearly defined. If you cannot think of it, the leader does not agree with this log thinking, because when designing the program architecture, the try catch method has been set to capture errors for each function (probably due to the C ++ programming Specification). In the opinion of the leader, our job is to add the codes that record these exceptions in these try catch, and the code is completely different, just by adding some special string information, as the basis for positioning.
Therefore, common errors such as "not applying Object references to the correct object instance" have become the biggest killer of tracking errors. In many cases, such errors may occur in many places, the only thing you can do is to debug the code along the business logic step by step. It looks cool, but in fact this is very inefficient, especially when the product is launched, such a problem occurs, you have no way to conduct gradual debugging. How to locate the problem becomes a "Difficult Problem" that only people who are very familiar with the code may "Calculate "......
Later, the leaders realized that such positioning was indeed a major obstacle. Therefore, in the next project I was scheduled, they specifically asked me to use unit tests because I was using them.. NET environment, so at that time, I had learned some of the unit test functions, but I didn't have much time to study them systematically. Then I added my own lazy thoughts, so after a long delay, unit testing is also aborted and replaced by testing each subdivision module one by one. This is clearly not the essence of unit testing ......
It has been more than two years of coding, and more people feel the pressure on the two aspects mentioned above, especially when a system is very complex. In today's increasingly rampant frameworks, is it possible to solve unit testing and troubleshooting only through good habits as a key breakthrough? (in my current opinion, there may be good ideas, still hope to correct !)?
As a result, I had little experience writing code by myself. Based on my current project, I imagined a programming "architecture" to solve the above two problems, that is, the "three-stage" programming, where the log records (that is, troubleshooting) have been implemented in a simple way, and it may still need to be further corrected. The next step is to add the unit test to it ......
In addition to using some unit tests that are prevalent on the internet, I prefer to design a testing structure that is more "civilian ...... Updating at any time: