20172325 Student ID 2017-2018-2 "Program Design and Data Structure" Experiment 2 Report

20172325 Student ID: 2017-2018-2 "Program Design and Data Structure" Experiment 2 Report
Course: "Program Design and Data Structure"
Class: 1723
Name: Deng Yukun
Student ID: 20172325
Experiment Teacher: Wang Zhiqiang
Experiment Date: April 23, 2018
Compulsory/Elective: Compulsory

1. Experiment content

  • 1. Preliminary mastery of unit testing and TDD
  • 2. Understand and master the three elements of object-oriented: encapsulation, inheritance, polymorphism
  • 3. Preliminary grasp of UML modeling
  • 4. Familiarize yourself with SOLID principles
  • 5. Understand Design Patterns
  • 6 Complete the (1)-(5) experiments on the blue ink cloud.

2. Experimental process and results

experiment one:

  • When I did experiment one, I made it according to the teacher's blog, and the process was very smooth.
  • code link

Experiment 2:

  • Experiment 2 is also very smooth according to the tutorial, and the understanding of TDD is also helpful
  • code link

Experiment three:

  • The content of Experiment 3 is to expand the design use case, according to the remainder of the student number divided by 6, from which to experience the OCP and DIP modes. In general, after finishing it, the content is mainly cumbersome, and we need to pay attention to a lot of details. If one place is wrong, it will not work all the time, but it is really convenient for IDEA to give tips in the wrong place, like it.
  • So what are these two knowledge?
  • OCP is the Open-Closed Principle.
    My simple understanding is that the subclass can inherit the parent class more conveniently under certain restrictions, which reflects the importance of abstraction;
  • DIP is the Dependency Inversion Principle, the Dependency Inversion Principle
    The definition and benefits of DIP have been well explained through this figure. The following is the third result of my experiment and the code cloud connection.
  • code link

Experiment four:

  • I spent a lot of effort in the practice process of Experiment 4, mainly on the understanding and application of the test class. During the whole process, I carried out a lot of unnecessary steps, which made simple things troublesome, but with repeated repetitions After repeated revisions and discussions, I was barely successful in the stumbling block, but it deepened my understanding of TDD, that is, to focus on the test points and grasp the inheritance and modification of each class.
  • code link

Experiment five:

  • The fifth experiment is mainly to learn to draw a class diagram, that is, UML diagram. There are many such diagrams in the textbook. Now I am learning to build it myself, which is very interesting. It seems that this is just a drawing tool, but what it reflects is the core idea of ​​programming. Before writing a program, we need to have a macro grasp of the whole process, and then to control the details. UML class diagrams It can guide us to analyze the programming ideas step by step. Therefore, building UML class diagrams before specific practice can help us clarify our ideas and clearly analyze each process.

3. Problems encountered during the experiment and the solution process

• Question 1: I just started to use Junit to test a class, I don't know its principle, so when I wrote several test classes, I built three or four test classes separately. It doesn't make much sense, so it's a disservice.
• Solution to problem 1: After understanding its operation principle, it can test different negative problems at the same time in a test class, and it can detect the test points by itself. After the test is over, the problem is clear at a glance, and it begins to be discovered. its advantages.

• Problem 2: In the third test, the integer number is output under the Double class.
• Solution to problem 2: Try to modify each place where the data type is declared one by one, and finally find the key step, make the modification, and correctly output the desired data type.

References
A little explanation of Experiment 2 "Java Object-Oriented Programming"
Experiment 2 Java Object-Oriented Programming
Intellj IDEA Simple Tutorial

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324850106&siteId=291194637
Recommended