Experiment 2 Java Object-Oriented Programming

Experimental content

  1. Getting started with unit testing and TDD
  2. Understand and master the three elements of object-oriented: encapsulation, inheritance, polymorphism
  3. Preliminary mastery of UML modeling
  4. Become familiar with SOLID principles
  5. Learn about design patterns

Experimental procedure

Topic one:

(1) Unit testing

100-point scale to 5-point scale: If the grade is less than 60, transfer to "Fail" If the score is between 60 and 70, transfer to "Pass" If the score is between 70 and 80, transfer to "Fair" If the score is between 80 and 80 Between 90, convert to "Good" If the grade is between 90 and 100, convert to "Excellent" Otherwise, convert to "Error".

Topic two:

Study and learn StringBuffer in the way of TDD

Topic three:

Expand the design pattern examples, realize the application of OCP principles and DIP principles, and have a preliminary understanding of design patterns

Let the system support the Float class, and add test code in the MyDoc class to show that the addition is correct.

Topic four:

topic five

Use StarUML to model the code in the second experiment, send a screenshot of the class diagram, and add the student number watermark.

 

Experiment summary and experience

  • You can design the corresponding code according to your needs, don't waste your energy on the code you don't want;
  • When designing code, consider problems more comprehensively, and it is not easy to miss important links;

PSP:

step time/min percentage/%
demand analysis 10 9
design 20 18
Code 30 27
test 20 28
analysis Summary 30 27

Guess you like

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