20165222 "Java Programming" - Experiment 2 Object-Oriented Programming

20165222 "Java Programming" - Experiment 2 Object-Oriented Programming

Submission point 1, JUnit test case

Knowledge point: here is to understand the application of the test code. The test code is written as: @Test

assertEquals("result", classname.staticname(condition));

Problems encountered: Because I just came into contact with new things, it took a long time to get the junit package in at the beginning, and the Test was still red, which made it impossible to run. Later, the path was changed before the experiment came out.

The experimental screenshot is:

 

Submission point 2, TDD method to learn StringBuffer

Knowledge point: Here is the test of different methods to understand the role of these different methods. For example: capacity returns the current maximum capacity. lengh gets the length of the string.

Submission point 3: Application of OCP principles and DIP principles

My topic is to make the system support the Float class, and add the test code to the MyDoc class to indicate that the addition is correct, submit the test code and screenshots of the running result, and add the student number watermark.

Commitment point 4: Develop a complex number class

Here is the complexity of writing code, and there is not much to summarize.

Commitment Point 5: UML Modeling

Experimental summary

1. Code cloud link: https://gitee.com/BESTI-IS-JAVA-2018/20165222lixu

2 In this experiment, the most important point is the junit test. It was a bit difficult to get in touch at first, but after getting familiar with it through the experiment, I have a basic understanding of the junit test.

step Time (min) percentage
demand analysis 20 9.52
design 40 19.1
Code 100 47.6
test 30 14.3
analysis Summary 20 9.52

Guess you like

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