GitHub Warehouse: Https://github.com/TaoTaoLv1/WcProject I. Pre-development PSP table estimate *
PSP2.1 |
Personal software Process Stages |
Estimated time-consuming (minutes) |
actual time elapsed (minutes) |
Planning |
Plan |
30 |
30 |
· Estimate |
· Estimate how long this task will take |
30 |
30 |
Development |
Development |
464 |
655 |
· Analysis |
· Demand analysis (including learning new technologies) |
20 |
30 |
· Design Spec |
· Creating a design Document |
30 |
60 |
· Design Review |
· Design Review (and colleagues review design documents) |
60 |
60 |
· Coding Standard |
· Code specification (to develop appropriate specifications for current development) |
30 |
40 |
· Design |
· Specific design |
30 |
60 |
· Coding |
· Specific code |
240 |
300 |
· Code Review |
· Code review |
30 |
60 |
· Test |
· Test (self-test, modify code, commit changes) |
24 |
45 |
Reporting |
Report |
80 |
80 |
· Test Report |
· Test report |
20 |
40 |
· Size Measurement |
· Computational effort |
30 |
20 |
· Postmortem & Process Improvement Plan |
· Summarize afterwards and propose process improvement plan |
30 |
20 |
Total |
|
574 |
765 |
Second, the project thinking
Basic requirements
-C Statistics File character count (Implementation)
-W Statistics file Word count (Implementation)
-L Statistics File line count (Implementation)
Extended Functionality
- -s recursive processing directory for eligible files (Implementation)
- -A returns the file code line/blank line/Comment line (Implementation)
Advanced Features
- []-X graphical interface (not implemented)
Parameter Implementation section:
- -C: Each read into a character, the counter plus one.
- -W: Each read into a character that is not a word, and a character that belongs to a word before it, and the counter adds one. The initial assumption of the word character is that "a" ~ "Z" and "a" ~ "Z" shall prevail.
- -L: Each read into a newline character, the counter plus one.
- -A (blank line \ Comment line \ code line): one row per read, one-time statistics
- -S: Enter the file path and continue typing to find the name of the file to support fuzzy search.
Third, the design realization process
Code Startup Class Main.java
public class Main {public static void main (string[] args) {Commandcontroller Commandcontroller = new Commandco Ntroller (); while (true) {System.out.println ("\n*********************************************"); SYSTEM.OUT.PRINTLN ("* * * * [filename] Returns the number of file characters * * *"); SYSTEM.OUT.PRINTLN ("* * * * [filename] Returns the number of file words * * * *"); SYSTEM.OUT.PRINTLN ("* * * * [filename] Returns the number of file lines"); SYSTEM.OUT.PRINTLN ("* * * * [folder] Search file name * * * *"); SYSTEM.OUT.PRINTLN ("* * * * [file name] Statistics code line/blank Line/Comment Line * * * * * * *); System.out.println ("*********************************************"); System.out.print ("Please enter command:"); Scanner s = new Scanner (system.in); String m =s.nextline (); String arr[]=m.split ("\\s"); Commandserver Server = Commandcontroller.searchcontrolscommand (arr[0]); Server.command (arr[1]); } }}
Commandcontroller
public class Commandcontroller {public commandserver searchcontrolscommand (String command) { commandserver Server = null; Switch (command) {case "-C": Server = new Charactercountserver (); break;//Returns the number of file characters case "-W": Server = new Wordcoun Tserver (); break; Returns the number of file words case "-l": Server = new Rowcountserver (); break; Returns the number of file lines case "-S": Server = new Conditionfileserver (); Search file name Case "-a": Server = new Complexcountserver (); break; Statistic code line/blank line/Comment line default: System.out.println ("parameter input is incorrect"); } return server; }}
Test
Test file:
Test results:
Code Coverage
Conducting code Coverage testing
Overall code coverage is 86%
Java implements WC partial functionality