The eighth chapter, object-oriented design
The basic features of object-oriented programming are: 1, encapsulation: encapsulation refers to the object-related information and behavior state bundled into a unit, the object is encapsulated into a specific class. Encapsulation hides the concrete implementation of an object, and when you want to manipulate the object, you only need to invoke the method, rather than the concrete implementation of the method. 2, Inheritance: One class inherits another class, the inheritors can obtain all the methods and properties of the inherited class, and can add new methods according to the actual needs or overwrite the methods in the inherited class, the inheritors is called the parent class or the superclass, the inheritors is called the subclass or the export class, and the inheritance improves the reusability of the program code. A subclass in Java can inherit only one parent, and the object class is the ultimate parent class for all classes. 3, polymorphism: polymorphism refers to the same behavior of different objects to the same thing, a Class A can point to its own class and its export class, an interface can point to its interface implementation class, in the method parameters, the use of polymorphism can improve the flexibility of the parameters.
Object-oriented design and object-oriented differences:
(1) In the focus, object-oriented analysis focuses on understanding the problem, describing what the software does, while the object-oriented design focuses on understanding the solution, describing how the software should be done.
(2) Object-oriented analysis generally only consider the ideal hungry design, do not care about the technical and implementation level of detail, and object-oriented design needs to get more specific, more detailed, closer to the real code design.
(3) The object-oriented analysis phase focuses on describing the behavior of the object, while the object-oriented design phase focuses on describing the properties and methods of the object in the design results.
(4) Object-oriented analysis focuses only on functional requirements, while object-oriented design focuses on functional requirements and non-functional requirements.
(5) The system model produced by object-oriented analysis is usually small, and the system model produced by object-oriented design is large in scale and content is more detailed and complete.
The eighth chapter, object-oriented design