Primary and secondary school mathematics examination paper automatically generating program - code analysis of Guo students

A few days ago, we completed the preparation of project engineering individual project under the course requirements, namely a primary and secondary school mathematics examination paper automatically generated program.

The main function of the program is the default user account login can choose to be a small high grade mathematics examination paper correspond to the topic and generate the corresponding txt text.

This paper analyzes for the project partner G, a number of processes to explain the pros and cons of the project.

It needs analysis, project difficulty is

1. The use of the file stream, generating includes generating, paper folder txt

2. random topic has been the subject of a guarantee will not be repeated

3. The subject of mathematical logic rigor

advantage:

  1. File path using a relative path. File path having a relative and absolute paths in two forms, the absolute path may be such that the program poor reusability, so can not run on another terminal, using the relative path in the program have become strong adaptability , the current path including ./, .. / upper level directory is used to improve the robustness of the code.
  2. Use try catch to catch exceptions when using file stream IO. IO input error-prone, because there may be a wrong file path, file can not be found and other run-time errors at compile stage is i can not find these problems, so a try catch catch anomaly is very necessary and rigorous.
  3. Topic re-check. Every topic will file generated when the examination paper clip in the teacher appeared in the title were re-check, will be the subject of other papers and folders, including the current topic and volume for comparison, if the same, this is not the problem It will be output to the papers. More comprehensive title search reset, use the File class list () method, list () method returns the file names of all files and directories in a directory, returns a String array.
  4. java language proficiency. We can clearly use static static variables, File class and BufferrdWriter class using a file stream, as well as classes InputStreamReader and BufferedReader classes such as file input.

However, it is a pity that it has its pluses and minuses

Disadvantages:

  1. There is not much reflect the thinking of java oop. Oriented-Object  Programming, object-oriented programming idea can be seen as comprising a variety of independent and call each object in the program instead of the program will be seen as a collection of functions. The project calls does not reflect too much between object-oriented independent object, but simply some of the programming process-oriented, just a collection of function calls.
  2. In some places you can consider optimizing. Complex logic such as code in a melted mixed place, is not clear enough, it can be considered more functions into smaller, improve code readability. Increase determine whether to establish a folder, if the folder does not exist, the program creates, you can reduce the preparatory work.

Personal items: primary and secondary school mathematics examination paper automatically generating program 

The preparation of project needs, let me once again returning to the use of c ++ header files and implementation of the package in the form of a separate program, a review of previous knowledge. And discuss the pros and cons and partner G between the different program logic, and different programming languages ​​to achieve the degree of difficulty of this project, but also once again familiar from the original is just the entry of java language, benefit.

Guess you like

Origin www.cnblogs.com/cc1551/p/11549367.html
Recommended