20145237 experimental content of "Java Object-oriented programming"
• Understand and master the object-oriented three elements: encapsulation, inheritance, polymorphism
• Initial mastery of UML modeling
• Familiarity with S.O.L.I.D principles
• Implement plural classes with TDD design
Experimental steps
Unit Test
1. Three kinds of code:
• Pseudo code:
Percentile five-point system: If the score is less than 60, turn to "fail" if the score between 60 and 70, turn into "pass" if the score between 70 and 80 , turn into "medium" if the score between 80 and 90, turn into "good" If the score is between 90 and 100, turn into "excellent" other, turn to "error"
Product Code:
3. Test code
Public classGrade { Public Static voidMain (string[] args) {if(Grade.grade ( -) !="inferior lattice") System. out. println ("Test failed!");ElseSystem. out. println ("Test passed!");}}
TDD (test-driven development)
· 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
. Object-oriented three elements
The three elements of object-oriented (object-oriented) include: encapsulation, inheritance, polymorphism. Object-oriented thinking involves all aspects of software development, such as object-oriented analysis (OOA), Object-oriented design (OOD), and object-oriented programming (OOP). OOA decomposes The system according to the abstract key problem domain and focuses on what. Ood is an object-oriented implementation of the symbolic design system, which constructs the system into a "real-world" object in a way that is very close to the problem domain terminology, and focuses on how to implement the functional specification through the model. OOP is coded in a programming language (such as Java) on a design basis. The main line that runs through OOA, Ood, and OOP is abstraction. Ood Modeling uses the graphical Modeling language UML (Unified Modeling Language), UML is a generic modeling language.
The result of a process abstraction is a function, and the result of the data abstraction is an abstract data Type,adt, which can be used as an ADT with inherited and polymorphic mechanisms. Data abstraction is the core and origin of OOP.
The first element of the OO three elements is encapsulation, which is the encapsulation of data and related behaviors to be wrapped together to implement information hidden. Java uses classes for encapsulation, such as a dog class:
Psp
Steps |
Take |
Percentage |
Demand analysis |
10 |
14% |
Design |
15 |
21% |
Code implementation |
10 |
14% |
Test |
20 |
28% |
Analysis Summary |
15 |
21% |
20145237 experimental Two "Java Object-oriented programming"