What are the main characteristics of an object-oriented approach?
(1) Object uniqueness. Each object has its own unique identification, through which the corresponding object can be found. Throughout the life of the object, its identification does not change, and different objects cannot have the same identification. (2) Abstractness. Categoricality refers to the abstraction of objects with consistent data structures (attributes) and behavior (operations) into classes. A class is such an abstraction that it reflects important properties relevant to the application and ignores some other irrelevant content. Any class delimitation is subjective, but it must be relevant to the specific application. (3) Inheritance. Inheritance is the mechanism by which subclasses automatically share the data structures and methods of the parent class, which is a relationship between classes. When defining and implementing a class, it is possible to build on top of a pre-existing class, taking what is defined by this pre-existing class as its own and adding several new elements. Inheritance is the most important feature of object-oriented programming languages that distinguishes them from other languages and is not found in other languages. In the class hierarchy, a subclass that inherits the data structures and methods of only one parent class is called unary inheritance. In the class hierarchy, when a subclass inherits data structures and methods from more than one parent class, it is called multiple inheritance. In software development, class inheritance makes the created software open and expandable, which is a proven method of organizing and classifying information, it simplifies the workload of creating objects and classes and increases the reusability of the code. Inheritance is used to provide a standardized hierarchy of classes. Through the inheritance relationship of the class, the public characteristics can be shared, which improves the reusability of the software. (4) Polymorphism (polymorphism) Polymorphism refers to the fact that the same operation or function or procedure can act on multiple types of objects and obtain different results. Different objects that receive the same message can produce different results, a phenomenon known as polymorphism. Polymorphism allows each object to respond to a common message in a way that suits it. Polymorphism enhances the flexibility and reusability of software. I hope you’ll adopt it.
What are the aspects of object-oriented features
Object-oriented features include encapsulation, inheritance, polymorphism and abstraction aspects.
Ignoring what is not relevant to the current goal in a subject, focused attention is given to aspects that are relevant to the current goal. Abstraction does not intend to understand the whole problem, but selects a part of it and does not use some of the details for the time being. Abstraction consists of two aspects, a data abstraction, rather a process abstraction.
Encapsulation is one of the characteristics of object orientation and is the main feature of the concept of objects and classes. Encapsulation is to surround the process and data, access to the data can only be through the defined interface. Such as private variables, with set, get methods to get.
Encapsulation ensures that the module has a better independence, making it easier to maintain and modify the program. Modifications to the application are limited to the interior of the class, thus minimizing the impact of application modifications.
A hierarchical model that links classes and allows and encourages class reuse, providing a way to explicitly express commonality. A new class of an object can be derived from an existing class in a process called class inheritance. The new class inherits the characteristics of the original class; the new class is called a derived class (subclass) of the original class, and the original class is called the base class (parent class) of the new class.
A derived class can inherit methods and instance variables from its parent, and the class can modify or add new methods to make it more suitable for particular needs. Thus, it can be said that inheritance is used to reuse the code of the parent class and also to prepare for polymorphism.
Polymorphism is the practice of allowing objects of different classes to respond to the same message. Polymorphism includes parameterized polymorphism and inclusion polymorphism. Polymorphic language has the advantages of flexibility, abstraction, behavior sharing, code sharing, a good solution to the problem of application functions with the same name.
In a nutshell, method overriding, overloading and dynamic linking constitute polymorphism. one of the reasons why java introduced the concept of polymorphism is to make up for the lack of functionality brought about by single inheritance of classes.
What are the main characteristics of object-oriented methods?
The main features of the object-oriented approach are:
Encapsulation is an information hiding technology, which is embodied in the description of the class, is an important characteristic of the object. Encapsulation so that the data and the processing of the data method (function) encapsulated as a whole, in order to achieve a strong independence of the module, so that the user can only see the external characteristics of the object (the object can receive which messages, with those processing capabilities), while the internal characteristics of the object (save the internal state of the private data and the realization of the processing capabilities of the algorithm) is hidden from the user.
Inheritance is the mechanism by which subclasses automatically share data and methods between parent classes. It is reflected by the derived functionality of the class. A class directly succeeds all the descriptions of other classes, and can be modified and expanded at the same time.
Objects act according to the message received. The same message for different objects can produce completely different actions, this phenomenon is called polymorphism. With polymorphism the user can send a generic message and leave all the implementation details up to the object receiving the message, such that the same message can invoke different methods.
Superiority of Object-Oriented Approach
(1) Emphasis on understanding the problem domain and constructing the system from the things (objects) that objectively exist in the real world, which makes it much less difficult for the system developer to understand the problem domain, and thus allows the system to reflect the problem domain more accurately.
(2) Applying everyday human thinking methods and principles (embodied in the basic principles of abstraction, categorization, inheritance, encapsulation, message communication, etc. of the OO method) to system development is beneficial to the use of human thinking ability and effectively controls system complexity.
(3) The concept of object throughout the end of the development process, so that each stage of the development of the system components with a good correspondence, which significantly improves the development of the system efficiency and quality, and greatly reduces the difficulty of system maintenance.
(4) The consistency of the concept of object, so that all types of personnel involved in system development in the development of all sections of a common language, effectively improving the communication and collaboration between personnel.
(5) The relative stability of the object and the isolation of volatile factors enhance the system’s resilience.
(6) The inheritance relationship between object classes and the relative independence of objects provide strong support for software reuse.