# 20182304 experiments eight "Object-oriented programming and data structures" test report

20,182,304 experiment eight "Object-oriented programming and data structures" test report

Course: "Programming and Data Structures"
Class: 1823
Name: Zhang child is
Student ID: 20182304
experiments Teacher: Johnny
experiment Date: September 17, 2019
Compulsory / Elective: Compulsory

1. Experimental content

  • Reference materials PP16.1, LinkedBinaryTree complete realization chain tree (getRight, contains, toString, preorder , postorder)
    for their implementation LinkedBinaryTree testing with JUnit or write your own driver class, submit test code run shot, to full-screen, contains its own Student ID information
    under the code pushed to the class code hosting platform
  • Based LinkedBinaryTree, Based on (in order, first order) a unique sequence of two functional configuration㕚tree, such as given in sequence and subsequent HDIBEMJNAFCKGL ABDHIEJMNCFGKL, a tree structure in the drawings
    with their write driver or JUnit classes own implementation of the function test, submit test code run shot, to full-screen, contains its own student number information
    Course under the code pushed to code hosting platform
  • Own design and implement a decision tree
    to submit test code run shot, to full-screen, contains its own student number information
    Course under the code pushed to code hosting platform
  • Enter infix expression, use the tree to convert the infix expression to postfix notation, and output postfix expression and calculations (if not a tree, a normal score. If you use a tree, even though there is a small problem, but also to the discretion out)
    to submit test code run shot, to full-screen, contains its own student number information

2. Experimental procedure and results

  • 1.1 unit or more basic test, the test code write ideas more intuitive and simple. We should pay attention to multiple test sets simultaneously, not only to the results of the tests are normal, but also for the wrong test results and test the boundaries, so as to find a more comprehensive problem code.
  • 1.2 TDD during the test, we need to download the plug-in JUnit, TDD required to write test code, and then complete the product code, test cases express the demand for the product code, as long as the product code can be tested on it.
  • 2.1 Packaging: The object should be packaged, the package is packed with data and related behaviors in order to achieve information hiding, either class achieve hidden details, and also avoid direct manipulation of the class attribute. Package actually controls the degree of modification of a user and access data class, the method can only provide those services through the object interacts with other parts of the program, the interface means is an accurate description of the package.
  • 2.2 Inheritance: Inheritance is the process derive a new class from an existing class by creating a new subclass to inherit a particular class, subclass both inherited functions from a class, they can define their own variables and methods, resulting in new features. Inheritance is the foundation to achieve software reuse, scalability and maintainability is the main way to improve software system.
  • State more than 2.3: Polymorphism is the reference variable at different points in time the ability of different types. Polymorphism is a phenomenon different code will be executed when the members of the different methods of the same class object to call a signature. Polymorphism can achieve the same name of the method, but achieve different. That is "the same interface, multiple methods." Polymorphism is the flexibility and scalability of basic object-oriented programming.
  • 3.1 UML class diagram, each class may contain three parts: a class name, attributes, operations (methods). UML class diagrams own syntax, type name of the variable after the variable name, a colon between them as a separator, the method of the + and - indicate visibility. Arrow points, and indicated that a known class using another class in some way (call). But I now grasp the method of drawing software is not yet in place.
  • 4. The results have been sent to the cloud screenshots class lessons.

3. Experimental problems encountered in the process and settlement process

  • Question 1: During TDD experiment in solving the problem of red TestCase after Lou teacher, @ test is still red
  • Problem 1 Solution: Use only after the import junit.framework.TestCase, do not use importorg.junit.Test, the lack of import path and add back to normal
  • Question 2: When TDD test, after clicking on the small bulbs generate .test empty file, and does not generate ready-green folder
  • Problem 2 Solution: Baidu, from their home directory, right-Directory naming new file named test, and then right-click the test, select the Test source root in make directinon as bar, this folder will become a successful test file
  • Question 3: In the preparation of the fourth job, if I want to use (object obj)when mass participation, to determine whether two complex numbers are equal test program has been an error
  • Question three solutions: I'm the parameters for the object type of use has not been well understood, the result can only be run first posted, needs further study to learn
public boolean equals(Object obj) {
       if (this == obj)
           return true;
   else
           return false;
   } 

Other (perception, thinking, etc.)

  • We need a rigorous and meticulous enough to knock when the code, as long as a little red mark where the program is not running properly
  • Read textbooks to be diligent, be familiar with the contents of textbooks, many experimental content such as UML syntax to write in the textbook, I ignore this leads to a problem Experiment 5

Reference material

Guess you like

Origin www.cnblogs.com/acgacg/p/11879135.html