Object-oriented, What Is Object-Oriented

Source: Internet
Author: User

Object-oriented, What Is Object-Oriented

Object-oriented technology is a popular system design and development technology. It includes Object-Oriented Analysis and object-oriented programming. The proposed object-oriented programming technology mainly aims to solve the code reuse problem which cannot be solved by the traditional programming method-structured programming design. Object-Oriented programming methods have three basic features: 1. abstract: (not main) abstraction is to ignore those aspects irrelevant to the current goal in a topic, so that you can pay more attention to the aspects related to the current goal. Abstraction is not intended to understand all the problems, but to select a part of the problem. For example, we want to design a student achievement management system. When we look at the student, we only care about his class, student ID, and score, instead of caring about his height and weight. Abstract: Process abstraction and data abstraction. Process abstraction means that any operation with clearly defined functions can be viewed by users as a single entity, although this operation may actually be completed by a series of lower-level operations. Data abstraction defines the data type and operations applied to this type of object, and limits the object values to be modified and observed only by using these operations. 2. Inheritance:
Inheritance is a hierarchical model that connects classes and allows reuse of encouraging classes. It provides a way to clearly express commonalities. A new class of an object can be derived from an existing class. This process is called class inheritance. The new class inherits the features of the original class. The new class is called the 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 base class, and the class can modify or add new methods to make it more suitable for special needs. This also reflects the general and special relationship between nature. Inheritance solves the reusability of software. For example, all Windows applications have a window, which can be viewed as derived from a window class. However, some applications are used for text processing, and some applications are used for drawing. This is because different subclasses are derived and different features are added to each subclass.
3. encapsulation: encapsulation is one of the characteristics of object-oriented, and is the main feature of object and class concepts. Encapsulation is to enclose the process and data. Data access can only be performed through the defined interface. Object-oriented computing begins with the basic concept that the real world can be depicted as a series of completely autonomous and encapsulated objects that access other objects through a protected interface. Once an object's features are defined, it is necessary to determine the visibility of these features, that is, which features are visible to the external world and which features are used to represent the internal state. Define the interface of the object at this stage. In general, direct access to the actual representation of an object should be prohibited, but the object should be accessed through the operation interface, which is called Information Hiding. In fact, Information Hiding is a user's understanding of encapsulation, and encapsulation provides support for information hiding. Encapsulation ensures that the module has good independence, making program maintenance and modification easier. Modifications to an application are limited to the internal class, so that the impact of application modifications can be minimized. 4. Polymorphism: allows different types of objects to respond to the same message. For example, in the same addition, adding two times together and adding two integers together must be completely different. For example, the editing and pasting operations have different effects in the word processing program and drawing program. Polymorphism includes parameterized polymorphism and inclusion polymorphism. The polymorphism language has the advantages of flexibility, abstraction, behavior sharing, and code sharing, which effectively solves the same name problem of application functions. Object-Oriented Programming has many advantages: 1. Short development time, high efficiency, high reliability, and stronger developed programs. Due to the reusability of object-oriented programming, a large number of mature class libraries can be used in applications, thus shortening the development time. 2. Applications are easier to maintain, update, and upgrade. Inheritance and encapsulation make the impact of application modifications more localized.

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.