Pair programming work | |
---|---|
GitHub project address | https://github.com/15565048308/PairProgramming |
Partner blog address | https://www.cnblogs.com/XYFWXR/ |
Work address | https://www.cnblogs.com/cherish599/p/11577268.html |
A, PSP table
| PSP2.1 | Personal Software Process Stages | Estimated time consuming (minutes) | actual time-consuming (minutes) | | - | - | - | - | | Planning | program | 15 | 30 | | Estimate | estimated that this task requires much time | 900 | 1020 | | development | development | 720 | 840 |
| the analysis | needs analysis (including learning new technologies) | 80 | 120 | | design Spec | generate design documents | 20 | 15 | | design review | design review (and his colleagues reviewed the design documents) | 15 | 15 | | Coding Standard | code specifications (for the current development to develop an appropriate normative) | 30 | 20 |
| design | concrete design | 40 | 60 | | Coding | particular coding | 450 | 500 | | Code Review | Code Review | 30 | 35 | | test | test (self-testing, modifying code, commit changes) | 100 | 120 | | test report | reports test report | 70 | 120 | | Size Measureme | computing workload | 10 | 5 | | Postmortem & process improvement plan | hindsight, and propose process improvement plan | 60 | 60 | | | total | 2445 | 2120 | About PSP see Zou Yan teacher blog
Second, the code design and implementation process
1 Program Design and Implementation
This project is further accomplished on the basis of existing naming system based on the realization of non-attendance will be named automatically written to the specified file and write different documents according to the number of non-attendance, time attendance as usual and subtract points if rebuilt basis, to reduce the burden on teachers named record. (1) random roll call to determine whether the student non-attendance (2) will be the first non-attendance FirstAbsent written document (3) randomly named, traversing the first non-attendance documents to determine whether the student absent from school a second time , if the second write absences document and give prompt, third empathy. (4) end of the course, teachers read documents, view absenteeism information. Structured as follows:
2 How to embody the principle of
1) Design By Contract (Design by Contract): Design by Contract is in accordance with certain provisions of the agreement to make some data, if you exceed the agreed program will not run how to reflect: In case input data, can be obtained as expected results (2) information hiding (information hiding): information hiding determining means and in the design module, such that the specific information (data or process) contained within a module, other modules do not need this information, it is not accessible of. How to achieve: information is hidden package of information, set access permissions public, protect private, etc. (3) Interface Design (interface design): on the name of the interface, inheritance relationships between functions, interfaces and interface design; good interface design you can enhance code readability, ease of use, changeability. How to achieve: the different function blocks written in different ways, and then packaged in the same class, enhanced readability, ease of calls (4) Loose Coupling loose coupling: between the object and the object you want loosely coupled, by increasing abstract (abstract class) to do or how to implement the interface: a basic software design principles is "low coupling, high cohesion", reducing the coupling between objects and object code design and easy to maintain, increase only the program it a method, not to mention all the cash loose coupling
Third, the code review process
(1) Code Specification Reference (2)
Fourth, the specific code
(1) When the stop named event fires, call the method
private void btnStop_Click(object sender, EventArgs e)
{
timerCallName.Stop();
//调用记录缺课次数的方法
AbsentTems();
}
(2) randomly selected character string (name) into the new method, the class is determined using the prompt MessageBox
public void AbsentTems()
{
string Str = stuList[i].Name;
if (MessageBox.Show("该学生是否缺课?", "Absent OR Not?",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
(3) is circulated and written documents absent student's name to view
if (Str.EndsWith ("S")==true )
{
stuList[i].Name += "T";
string Strpath3 = @"F:\软件工程文件\GisWinformPractice\WinformControlUse\TestFile\ThirdAbsent";
File.AppendAllText(Strpath3, Str + " ");
MessageBox.Show("取消考试资格来年重修!!!");
}
else if (Str.EndsWith ("F") == true )
{
//第四次尝试修改
stuList[i].Name += "S";
string Strpath2 = @"F:\软件工程文件\GisWinformPractice\WinformControlUse\TestFile\SecondAbsent";
File.AppendAllText(Strpath2, Str + " ");
MessageBox.Show("第二次缺课,离重修更进一步!!");
}
else
{
stuList[i].Name += "F";
string Strpath1 = @"F:\软件工程文件\GisWinformPractice\WinformControlUse\TestFile\FirstAbsent";
File.AppendAllText(Strpath1, Str + " ");
MessageBox.Show("第一次缺课,第一次重修半价哦!");
}
Show results
V. Additional features
This code is further accomplished on the basis of the existing code on the secondary classroom teachers absenteeism records list, lack of voice is not automatically broadcast. If the automatic voice roll call, this can be resolved (cold sick, etc.), but also attendance at teacher throat uncomfortable situation;
Sixth, unit testing
(1) unit test (2) Test Results Code