Personal Engineering Summary

Source: Internet
Author: User

PSP2.1

Personal Software Process Stages

Time

Planning

Plan

· Estimate

· Estimate how long this task will take

8

Development

Development

· Analysis

· Demand analysis (including learning new technologies)

0.5

· Design Spec

· Creating a design Document

0.5

· Design Review

· Design Review (and colleagues review design documents)

0

· Coding Standard

· Code specification (to develop appropriate specifications for current development)

0

· Design

· Specific design

2

· Coding

· Specific code

4

· Code Review

· Code review

0.5

· Test

· Test (self-test, modify code, commit changes)

2

Reporting

Report

· Test Report

· Test report

0.5

· Size Measurement

· Computational effort

0.5

· Postmortem & Process Improvement Plan

· Summarize afterwards and propose process improvement plan

1.5

Total

12

0x01 Design

In a sentence to summarize the needs of the students to give arithmetic problems. It is not difficult to consider the arithmetic problems of elementary school students, and it is easy to find that the numbers that appear include only integers and fractions, and all fractions are expressed in the form of true fractions. Each calculation consists of these numbers and operators, where operators include add, subtract, multiply, divide, and parentheses. It is not difficult to find that the multiplication numbers in the output are Unicode characters rather than ASCII characters, so this time use the C # language to avoid coding problems. (in C + + don't hit me ... )

Depending on this requirement, you can choose to construct a hierarchy: The calculation is made up of numbers. Therefore, the first thing to achieve is the number class and the calculation class. This requirement is easy to implement as long as the two classes have randomly generated functionality.

For a number class, we know that integers can be represented as special fractions, that is, the denominator is a fraction of 1. Then we can represent all the numbers in a uniform form.

Class number = {numerator, denominator}.

So what about the output? For the output of the numbers, we only need to overload the ToString () method to resolve a variety of output formats. In the ToString () method, determine whether the number is an integer, a true fraction with an integer part, or a fraction with no integer part, and select the appropriate format output.

You can then use these operators directly in your code by overloading the subtraction and comparison operations of the numeric classes.

With numbers, we're going to insert the operator now and make it a formula. When we learn infix expression calculation, we mentioned that we can use the stack to record the operation process. The program realizes using this idea, constructs the digital stack and the symbol stack to imitate the suffix expression the operation, the concatenation becomes the computation. For a more efficient weighing, I also introduced a numeric variable to hold the result.

Class formula = {Number stack, symbol stack, operation result},

One thing to note is that, unlike postfix expressions, which use two stacks to hold a calculation, the relationship between the operator and the number is indeterminate, and we need to artificially define the order of the symbols and numbers to ensure that all the cases can be calculated. For the output, it is still overloaded with the ToString () method to stitch two stacks.

Determining whether the two equations are equal is actually determining whether the operations of each step are equal. Therefore, the sufficient and necessary condition for the equality of two equations is that the symbol stacks are exactly equal, and the two operands in each operation are equal respectively. That is, when determining equality, you need to restore the entire process of two expression evaluation to compare. This is obviously very slow, and there is a very effective optimization in the back.

0x02 test

This program module is clear and well suited for modular testing. In this procedure, there is a unit module test for each module method, which ensures that the correct result can be returned without triggering an exception. (Due to limited time, a processing section was not tested.) For the test of program global function, the method of extreme data and large data volume is used to get the correct return result.

0X03 optimization

Weight: In front of the sentence, the process of weighing is very slow, because you want to fully restore the operational state of each step. So can you find an effective way to determine the approximate rate of acceleration? The answer is yes. For each calculation, we perform a computation and save the result of the calculation. For any of the two different formulas, it is obviously not possible to pass the same as a finite exchange. It turns out that this optimization can speed up the decision time by around 80%. With a single judgement as the basic unit, the time complexity of the program is O (n^2), so even after optimization, judgment is still the most time-consuming execution unit.

Output: The output of this program is a text file, each output a calculation and a result. Because the two-step output is continuous operation, if each output directly to the file, it will be blocked due to the slow response speed of the hard disk. As a result, buffer can be used as the output buffer to improve performance. This method significantly improves performance in the case of a small output, such as 100,000 consecutive executions and 20 calculations per output.

Calculation result: In this requirement, all the formulas cannot appear negative numbers during the operation, so the calculation of the result is accomplished in the process of judgment. This can save the writing results of the method, directly take a check.

0x04 test

Normal data test:

-R 10–n 10000

-R 3-n 100

Extreme data:

-R 1-n 100

-R 2-n 10000000000

-R 1000000-n 100

0X05 Summary

The project is not very difficult, but the quantity of demand is more. Before implementing the requirements, a unified design is required to meet the different requirements of the implementation. Design has played a very important role in this project. In addition, the project also fully reflects the importance of having a class library of their own.

Personal Engineering Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.