20165323 experiment two Java object-oriented programming

Source: Internet
Author: User
Tags hosting staruml

First, the experimental report cover

Course: Java Programming class: 1653 class Name: Yang Jinchao No.: 20165323

Instructor: Lou Jia Peng Experiment Date: April 16, 2018

Experiment time: 13:45-15:25 experiment number: two

Experiment Name: Java Object-oriented programming

Ii. contents of the experiment
    1. Initial mastery of unit testing and TDD
    2. Understanding and mastering object-oriented three elements: encapsulation, inheritance, polymorphism
    3. Initial mastery of UML modeling
    4. Familiarity with S.O.L.I.D principles
    5. Understanding Design Patterns
Third, the experimental step submission point one using JUnit, test cases

Knowledge Points:
1, the general steps of 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
2, the three elements of object-oriented (object-oriented) include: encapsulation, inheritance, polymorphism.
3, encapsulation is the data and related behaviors packaged together to realize the information is hidden. Classes are encapsulated in Java.

4, inheritance refers to the definition of a class can be based on another already existing class, that is, the subclass is based on the parent class, thus implementing the reuse of the parent code. Inheritance is the foundation of software reusability, and it is the main way to improve the expansibility and maintainability of software system.
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 study learning StringBuffer in the form of TDD

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;
Test yourself will not write junit test cases
Results:

Code Hosting

Submission point three experience the application of OCP principle and dip principle, understand the design pattern preliminarily

Knowledge Points:
OCP (open-closed Principle, open-closed principle)
DIP (Dependency inversion Principle, dependency inversion principle)
Submission Point requirements:
Let the system support the double 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

Commit point four develop a complex number class in TDD mode complex

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 understanding design patterns

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:

Problems encountered in the experiment

Problem one: The testcase in the code is red,

WORKAROUND: You need to put Junit.jar, and JUnit 4-12.jar into the project

Issue two: The use of STARUML is in a blank state and will not be modeled with it
Workaround: Search through the Internet to find the tutorial (5995610/), after learning to use

Experimental summary

This experiment let me have a preliminary understanding of JUnit's use, but also let me initially learn to model, for design patterns also have some understanding, for me to build the framework is very helpful, perhaps in writing code I still have a lot of lack of place, but through this experiment, let me deepen the application and understanding of Java content

20165323 experiment two Java object-oriented programming

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.