First, code specification
Consider the following arguments and refute / support for whether you need to have code specifications:
1. These norms are a waste of time in a bureaucratic system that wastes everyone's programming time and affects people's development efficiency.
2. I am an artist, a craftsman, I have my own norms and principles.
3. Norms cannot be enforced, and many exceptions should be allowed.
4. I am good at coding specifications, you can listen to me.
As for the code specification, I'm going to need code specification from my point of view. I don't quite agree with the above 4 points,
Because the program statement is used in the computer, it needs to be compiled into machine language. Although the man is alive, the machine is dead. So it must be impossible to be changeable in front of the rules of death.
Another thing to note is that we regulate our own code, to develop such a habit for future study and life is very helpful. It facilitates teamwork, reduces bug handling, lowers maintenance costs, and facilitates code review.
Second, code review
1#include <stdio.h>2#include <stdlib.h>3#include <time.h>4 #defineN 305 Main ()6 {7 intA,b,k,i,n;8 floatc,d;9 Srand (Time (NULL));Ten Do{ Oneprintf"\ n Please enter a number type (1. Integer 2. Decimal)-1 is the exit program:"); Ascanf"%d",&n); - - Switch(n) the { - Case 1: - { - for(i=0; i<n;i++) + { -A=rand ()% -+1; +B=rand ()% -+1; AK=rand ()%4+1; atprintf"%d", a); - Switch(k) - { - Case 1:p rintf ("+"); Break; - Case 2:p rintf ("-"); Break; - Case 3:p rintf ("*"); Break; in Case 4:p rintf ("/"); Break; - } toprintf"%d=\t\t", b); + } - Break; the } * Break; $ Case 2:Panax Notoginseng { - for(i=0; i<n;i++) the { +C=rand () *0.001+1; AD=rand () *0.001+1; theK=rand ()%4+1; +printf"%0.2f", c); - Switch(k) $ { $ Case 1:p rintf ("+"); Break; - Case 2:p rintf ("-"); Break; - Case 3:p rintf ("*"); Break; the Case 4:p rintf ("/"); Break; - }Wuyiprintf"%0.2f=\t", d); the } - Break; Wu } - Break; About } $ } - while(n!=-1); -}
This code review I chose is the code of Cheng Wei classmate.
Arithmetic This algorithm teacher does not stipulate what compiles the environment, therefore I use the simple C language c-free5.0 environment, I This classmate also uses this environment.
His code seems to be simple and readable, but it does not seem to reflect the function of the answer part, only the random number, random arithmetic.
Then the code is a little bit better, probably simple, not so many functions.
I Caishuxueqian, can only see this doorway. Still need to study hard and learn from others.
Third, PSP
PSP2.1 |
PSP Stage |
Time (%) SDE |
Planning |
Plan |
6% |
Estimate |
Estimate how long this task will take |
6 |
Development |
Development |
88% |
Analysis |
Demand analysis |
12 |
Design Spec |
Creating a design Document |
4 |
Design Review |
Design Review (and colleagues review design documents) |
8 |
Coding Standard |
Code specification (to develop appropriate specifications for current development) |
1 |
Design |
Specific design |
10 |
Coding |
Specific code |
23 |
Code Review |
Code review |
9 |
Test |
Testing (self-test, code modification, commit modification) |
21st |
Reporting |
Report |
6% |
Test Report |
Test report |
2 |
Size Measurement |
Computational effort |
1 |
Postmortem & Process Improvement Plan |
Summarize afterwards and propose process improvement plan |
3 |
Job Three: Code specification, code review, PSP