A, Github project Address:
https://github.com/Heiofungfming/xiaoming01
Two, PSP form
PSP2.1 |
SUMMARY |
Plans to complete the required time (min) |
The actual time required for completion (min) |
Planning |
plan |
45 |
40 |
Estimate |
It estimated that the task requires much time and planning generally work steps |
45 |
40 |
Development |
Develop |
880 |
800 |
Analysis |
Needs analysis (including learning new technologies) |
60 |
90 |
Design Spec |
Generate design documents |
30 |
- |
Design Review |
Design review (and colleagues reviewed the design documents) |
10 |
- |
Coding Standard |
Code specifications (development of appropriate norms for the current development) |
40 |
40 |
Design |
Specific design |
60 |
80 |
Coding |
Specific coding |
400 |
510 |
Code Review |
Code Review |
30 |
30 |
is |
Test (self-test, modify the code, submit modifications) |
250 |
200 |
Reporting |
report |
450 |
180 |
Test Report |
testing report |
300 |
370 |
Size Measurement |
Computing workload |
30 |
- |
Postmortem & Process Improvement Plan |
Later summarized, and process improvement plan |
60 |
80 |
Summary |
total |
2690 |
2460 |
Third, the problem-solving ideas description
Just got the title when the subject of the request is required to write a command-line program, the initial idea is to cmd command line call in written, thought for a moment and then they go back, as if before beginning to learn Java time, it is to use cmd command line calling program, use eclipse to write a functional part of the program at the beginning of the print run, can not find cmd calling program, a moment later Baidu, only to find the need to remove the code package can only be the beginning of the call.
One by one began to realize various functions, first after the basic functions to solve this problem, these three functions in school sophomore Java when writing a text editor to achieve over time (using character input and output stream implementation), so turn before code is found, and then slightly change the look directly used. With the function, but this feature still missing run a file path manually entered (the original file path is to knock code directly fixed good), this time in just re the Java , just to review IO stream, you use and file stream byte array input of the file path.
After basic function is to solve, extensions, first recursive sub-directory under the file, then the output of this function in line with the information specified file. This feature has several points to be addressed:
- Subfolders recursively read directory
- Find qualified subfolders
- Read the information inside the file
After a list of questions to find a solution:
- Prior review IO time streams wrote a recursive call to all files in a sub-directory, and the name of the output file, so this part is equivalent to solve the recursive
- Find a matching document is nothing more than to determine the file type, the first thought is to determine the file name to determine the file name is the file extension, so use endwish () to determine the recursive read sub-file suffix whether the conditions on it. Middle encountered a problem is how to enter the path + \\ * c or \? C this judgment to take, respectively, the original idea was to separate the input path and suffix character, but the roommates say this does not meet the subject requirements, and after roommate discussion, regular expression string are divided into two inputs take it.
- The basic method of adding functions to OK the.
And then returns file comment lines, blank lines, number of lines of code function, similar to the basic function, what elements exist for different types of line, after reading the corresponding plus a variable, an element of judgment and I Baidu a bit, need use regular expressions and over again, and then nested if statements
And finally to the advanced features, after reading requirements, to solve the problem:
- graphic interface
- The file can be selected, and the obtained file path
- Information obtained files
Solution:
- With a graphical interface windowBuilder directly generated
- With a JFileChooser the file selection button, and then obtain the file path with the file stream
- Integration of basic functions and extensions, call the 2 file paths obtained
Fourth, the design and implementation process
- flow chart:
2. The directory structure of the class
3. test file
4. Functional Test
4.1 -c function test
4.2 -w function
4.3 -l function
4.4 -s function
4.5 -a function
4.6 -x function
Fives. to sum up
With practice this personal project and found that there are survivors from various deficiencies
- The extent of the application of the language are not familiar with the code before from time to time look to see if his own statement is wrong, or logic errors
- When the project started watching the program did not build all kinds of good ideas, so after the emergence of various development stagnation
- Specification code (generally speaking, a lot of code repetition rate, had wanted to build a method to reduce the repetition rate of the code, but afraid of making mistakes and delays choose not to take action)
- For the above, the future is to seize the time to Java specifications of this linguistics fine, deep learning, the code should also be strengthened.