20165336 experiment two Java object-oriented programming first, experimental report cover
Course: Java Programming class: 1653 class Name: Kangzhijiang No.: 20165336
Instructor: Lou Jia Peng Experiment Date: April 16, 2018
Experiment time: 13:45-15:25 Experiment serial number: Experiment two
Experiment Name: Java Object-oriented programming
Experimental purposes and requirements:
Ii. contents of the experiment
1 Initial mastery of unit tests and TDD
2 Understanding and Mastering object-oriented three elements: encapsulation, inheritance, polymorphism
3 Initial mastery of UML modeling
4 Familiar with S.O.L.I.D principles
5 Understanding Design Patterns
Third, the experimental requirements
1. Students who do not have a Linux base are advised to start with the Linux basics (new version) Vim Editor course
2. Complete the experiment, write the experiment Report, the experiment report is published in the blog site blog, note that the experimental report is focused on the results of the operation, problems encountered (tool search, installation, use, program editing, commissioning, operation, etc.), solutions (empty methods such as "Check Network", "Ask classmates", "reading" And so on 0 points) and analysis (from which can get what revelation, what harvest, lessons, etc.), is strictly prohibited plagiarism.
Four, the experimental step submission point one
Knowledge Points:
The general steps for TDD are as follows:
- Clear the current functionality to be completed and record it as a test list
- Quick completion of writing test cases for this feature
Test code compilation does not pass (no product code)
- Write the Product Code
- Test Pass
- Refactor the code and ensure the test passes (refactoring the next lab session)
- Cycle through the development of all functions
The coding rhythm of TDD is:
- Add test code, JUnit appears red bar
- Modify the Product Code
- JUnit appears green bar, Task complete
Submission Point Requirements
Submit the last three JUnit test cases (normal, error condition, boundary condition) All pass, must have paint watermark, enter their own school number
This submission point examines whether JUnit will be used, and test cases should at least contain normal, error conditions, boundary conditions
Results:
Code Hosting
Submission Point Two
Knowledge Points:
- Learn to use the API
- Mastering TDD
Submission Point Requirements
Study StringBuffer in the way of TDD
Submit your Unit test case and test pass, to add the number watermark;
Testing yourself will not write junit test cases.
Results:
Code Hosting
Submission Point Three
Knowledge Points:
- Object-oriented three elements: encapsulation, inheritance, polymorphism
S.O.L.I.D Principles
Object-oriented three elements are "encapsulation, inheritance, polymorphism", and any object-oriented programming language will support these three elements syntactically. It is very difficult to use the three elements, especially polymorphism, with the help of abstract thinking, and the S.O.L.I.D design principle is a good guide:
- SRP (Single Responsibility Principle, sole responsibility principle)
- OCP (open-closed Principle, open-closed principle)
- LSP (Liskov substitusion Principle,liskov substitution principle)
- ISP (Interface segregation Principle, interface separation principle)
- DIP (Dependency inversion Principle, dependency inversion principle)
OCP is one of the most important principles in Ood, and the OCP's content is:
- Software entities (class, modules, function, etc) should open for extension,but closed for modification.
- Software entities (classes, modules, functions, etc.) should be open to expansion and closed to modifications.
Submission Point Requirements
Let the system support the short class, and add the test code in the MyDoc class to indicate the correct addition, submit the test code and run knot, plus the number watermark
Results:
Code Hosting
Submission Point Four
Knowledge Points:
- Proficiency in TDD
- Application of TDD to the test of complex program
Submission Point Requirements
Develop a plural class complex in TDD mode,
Submit your Unit test case and test pass, to add the number watermark;
Results:
Code Hosting
Submission Point Five
Knowledge Points:
- Learn to use WHITESTARUML
- Master Whitestaruml, interfaces, declaring variable parameters, and so on.
Submission Point Requirements
Use STARUML to model the code in experiment two, send class diagram, plus number watermark
Only two classes in a class diagram
Classes, inheritance, interface implementations, and combinations expressed in UML
Results:
V. Problems encountered in the experiment
Issue one: At the beginning of the completion of the submission point, you need to install Junit.jar, with JUnit 4-12.jar, otherwise part of the method and test idea will appear to be unable to run the results
Six, experimental thoughts
这次实验提高了我的动手能力,丰富了我的JAVA语言知识,让我对TDD的从懵懂到学会运用并掌握,这是一个质的飞跃,因为TDD可以解决很多的实际问题,与Java相关的Uml图也让我得到了了解,当自己静下心来慢慢琢磨代码时我认为是对一个信息安全系学生最有意义的时刻,当看着自己所编写的代码顺利运行时,心里的激动与喜悦是难以言表的,这次实验提高了我对JAVA的认识,提供给我了不同的解决问题的思考路径,这让我在今后的实验中获益匪浅。
20165336 experiment two Java object-oriented programming