20182303 2019-2020-1 "Object-oriented programming and data structures" Experimental Report 3
Course: "Programming and Data Structures"
Class: 1823
Name: Zhang Duanyun
Student ID: 20182303
experiments Teacher: Johnny
experiment Date: October 23, 2019
Compulsory / Elective: Compulsory
1. Experimental content
Download and install and use the IDEA, following the completion of the experiment ( https://www.cnblogs.com/rocedu/p/6371315.html ).
- Initial grasp of unit testing and TDD
- Understand and master object-oriented three elements: encapsulation, inheritance, polymorphism (self)
- Preliminary master UML modeling
- On completion of the cloud blue ink (1) - (5) experiments.
2. Experimental procedure and results
- Experiment 3.1
Reference http://www.cnblogs.com/rocedu/p/6371315.html#SECUNITTEST complete unit test study
submitted three JUnit test cases (normal, error conditions, border situation) through screenshots
- Experiment 3.2
Reference proactive knock code, JUnit learning the Java ( http://www.cnblogs.com/rocedu/p/4837092.html )
to study ways of learning TDD StringBuffer
- Experiment 3.3
Reference Experiment two Java object-oriented programming
design patterns example be expanded, experience OCP principles and applications of DIP principle, the preliminary understanding of design patterns
were taken over operations with their own student number% 6, code expansion based on the results:
the system Short class support and add test code in the class shows that adding the correct MyDoc
- Experiment 3.4
in a TDD manner to develop a complex class Complex, requirements are as follows:
// 定义属性并生成getter,setter
double RealPart;
double ImagePart;
// 定义构造函数
public Complex()
public Complex(double R,double I)
//Override Object
public boolean equals(Object obj)
public String toString()
// 定义公有方法:加减乘除
Complex ComplexAdd(Complex a)
Complex ComplexSub(Complex a)
Complex ComplexMulti(Complex a)
Complex ComplexDiv(Complex a)
- 3.5 Experiments
using StarUML two experimental modeling code
class in at least two classes FIG
classes, inheritance, interface, expressed in combination in UML
3. Experimental problems encountered in the process and settlement process
- Question 1: IDEA encountered problems uploading git
- Problem 1 Solution: The current directory is not a remote repository local directory, so brutally denied.
Other (perception, thinking, etc.)
The experiment difficult task, it takes a lot of time to complete. But also appreciate the knowledge is accumulated little by little, we can not expect to ask for the moon.