The first unit summary blog

The first job

Related design

  1. The first operation is relatively simple, I only designed the two classes. Item class and storing various items of coefficient indices;
  2. The various concepts identified using the top-down I assay, using a stored item ArrayList;
  3. After parsing of the expression entered, first time consolidation of similar items, reducing the number of items on request guide, based on test results to optimize the effect of doing so good, only the beginning of a negative number is not optimized to.

Measurement and analysis

I do not know why, for the first time complexity and class diagrams operation code can not be displayed, but the job is relatively simple, and uses a top-down analysis, all is not very complicated method.

Related bug

  • my own

    Due to the large heart brain, thanks to my students reported bug. Consider a situation where less, for example: - - x;
    in this case, two symbols are determined before the symbol for the item, the first form factor is -1 omitted.

  • other's

    I found a bug or analysis of various combinations of ideas, mainly in the various omissions;
    in addition to the case to be less about himself and found no other problems.

Second job

Related design

  1. The second job based on the job for the first item has been complicated, increasing the factor concept, represented with a multiplication factor, factor has a constant factor, power and trigonometric functions;
  2. Identify concepts still using the top-down analysis;
  3. Establishing a concept for each class, Expression class, Item type, Factor type, there is a special class for error handling;
  4. Expression class maintains a list of store items, Item class maintains a list of stored factor, Factor storage class kind factor and its index;
  5. Limited time, do a few simple optimization: for example, the "+ -" is replaced by "-", the factor "1" and the item "0" and the like are omitted, not worth mentioning.

Measurement and analysis

  • UML 类图

  • Complexity Analysis
  1. The complexity of the class

  2. The complexity of the method

Expression class or when the trigonometric () method is to separate the two trigonometric analysis, increased complexity, in fact, can be determined with, this to be improved;
digit for () method of +1 and -1 because of the presence omitted, then no pre-treatment, where the process is slightly complicated, but it can be simplified to the expression pretreatment, thereby reducing the complexity of the subsequent process.

Related bug

  • my own

    --1 wording owe this into consideration when handling, resulting in + -sin (x), --x this form is judged to be erroneous input, very sorry, but forget the "Next" when the bug fixes made me sad ;
    there is imperfect because the output leading to the final results show the wrong question.

  • other's

    From a variety of combinations, in particular to analyze various omissions;
    many bug to omit, for example - a + -1 these, most of the problems in determining the number of combined positive and negative symbols superimposed - -2.

The third operation

There are ideas not implemented, it was an invalid operations, not repeat them.

And comparing experiences

  • From the first job to the third operation, the difficulty of progressive layers, have a little idea.
  • About the job. Pretreatment can be done do first, can be very effectively prevent the subsequent code is too complicated. Like the first time before the merger operation as well as to optimize the benefits of similar items, the second of three jobs can use regular expressions to predict some of the WRONG FORMAT input, in addition to the space and can simplify symbols, etc., so that a simple expression input standardization, to facilitate the subsequent processing.
  • To read through the instructions, the above suggestions as possible adoption, some suggesting it should also be noted, had not met since points are reason enough range of numbers, and this was just mentioned in the guide book, he did not start seriously, honestly and later changed the.
  • There should be more thinking to think, write code, I think, "indecisive" very good, this is no lesson from the tragic submitted successfully repaired.
  • Also encountered some knowledge o'clock thorough as possible to see to see to understand, even if not this time, next time might also need to be inspired.
  • Required notices useful to help check the code, their own debug, write time is especially beneficial summary blog!

Guess you like

Origin www.cnblogs.com/mzny/p/12535734.html