Individual projects -WC (java achieve)

A, Github Address: https://github.com/silakami/wc.exe


 

Two, PSP form

PSP2.1 Personal Software Process Stages Estimated time consuming (minutes) The actual time-consuming (minutes)
Planning plan 30 30
   Estimate Estimate how much time this task requires 30 30
Development Develop 880 960
   Analysis demand analysis  50 40
   Design Spec Generate design documents 40 40
   Design Review Design Review  40 50
   Coding Standard Code Specification 30 30
   Design Specific design 30 40
   Coding Specific coding 600 650
   Code Review Code Review 40 40
   Test Test (self-test, modify the code, submit modifications) 50 70
Reporting report 120 140
   Test Report testing report 60 70
   Size Measurement Computing workload 20 30
   Postmortem & Process Improvement Plan Later summarized, and process improvement plan 40 40
Total total 1030 1130

 

Third, the problem-solving ideas

1, analysis of the subject, and needs analysis: this software can be divided into three modules, the first module is a function of various non-recursive, the second module is a wildcard and recursive lookup file, the third module is a visual interface, and it contains a variety of functions, in addition, and this also requires the user to interact, i.e., from a command prompt read command (file path and parameters) entered by the user. Complete analysis of each module, can be analyzed to obtain contact different functions within each module, and modules.

2, various non-recursive functions (that is, text statistics): realized characters, words, lines, blank lines, comment lines and statistics line of code, using a character stream IO operation, each line is read, and read the number of rows into the corresponding statistics, read until the return value is null, and the capture of IO errors, and prompts the user information, allowing users to modify the input.

3, recursive search files and wildcards: wildcard support, get user input, if the input is a folder, the file path to get a list of all the folder, recursively find, in order to avoid getting some files can not be read ( the .exe files), files of a filter portion, if the input is a query or a certain type of a file name, the file path to split the input to obtain file directory and file name, and the file name wildcard replaced with regular expressions, and as the matching criteria, use regular expressions to match the files in the directory, the same recursive lookups use, end up with a set of file names, and, in order to prevent recursion too deep causing the program card dead, there is also a limit on recursion depth, providing a better user interactive experience.

4, visual interface: This function is to allow users to interact through a graphical interface, allowing users to manually select the file, returns all statistics used here JFrame container.

5, interactive command line: This function is achieved by Scanner, and then to detect the input by regular expressions and file judging class to see if there is an illegal input.

6 integrated modules: the preparation of the main function, to clarify the relationship between calls within each module, and modules, at the same time to consider how to deal with all kinds of illegal input, enhancing the robustness of the program.

 


 

 

Fourth, the design process

  The main class is divided into the code, text statistic module, a processing module, the interface module of four parts, the following is a brief relationship:

 

 

 

 

 

 


 

Fifth, test run

1, empty file

 

 

 

 

2, only one character in the file

 

 

 

3, only one word file

 

 

 

4, the standard java source files

 

 

 

 

 

5, multi-nested file directory

  

6, wildcard test

  

 

 

7, the visual interface

 

 

 

  

 

 

 

 

8, various input error handling (not all)

 

 

There are visible on the map, the program basically realized the needs of the project, and has a certain robustness to withstand numerous incorrect input.

 

VI Project Summary

  The project uses java to develop, for the first time to follow certain norms do code development projects, compared to the practice in the past to do their own class-based and the like, it takes longer than before, but taking into account what is really more than ever before, contact the individual modules become more clear, do needs analysis does make the project more targeted, rather than read, read the code suddenly thought of several functions into Cadogan, which leads to problem areas even to rewrite the entire class program. Through this practice, I experience the software requirements analysis, design, development, testing process, in general, I really learned a lot of things, but also to the future needs of this kind of standardized programming habits.

 

Guess you like

Origin www.cnblogs.com/hxxh/p/11588567.html