Object-oriented understanding

Source: Internet
Author: User

I. Problems with traditional development methods

1. Poor software reusability
Reusability refers to the repeat of a single thing without modification or slight modification. Software reusability is one of the goals of software engineering.
2. Poor Software maintainability
Software Engineering emphasizes Software maintainability and the importance of documents, and stipulates that the final software product should be composed of complete and consistent configuration components. During software development, software readability, modification, and testability are always emphasized as important quality indicators of the software. Practice has proved that the maintenance cost and cost of software developed using traditional methods are still very high because of poor modification and maintenance, resulting in poor maintainability.
3. The developed software cannot meet user needs.
Using traditional structured methods to develop large-scale software systems involves knowledge in different fields. When developing systems with vague requirements or dynamically changing requirements, the developed software system often cannot meet the needs of users.
The stability, modifyability, and reusability of software developed using structured methods are poor. This is because structured methods are essentially functional decomposition, starting with a single process that represents the overall functions of the target system, from top to bottom, we constantly break down complex processing into sub-processing, so that layer-by-layer decomposition will continue until there are only a few sub-processing functions that are easy to implement, then, the corresponding tools are used to describe the processing of each lowest layer. Therefore, the structured method constructs the system around the "process" to implement the processing function. However, most of the changes in user requirements are for functions. Therefore, such changes are disastrous for process-based design. The system structure designed using this method is often unstable. Changes in user requirements often result in large changes in the system structure, which requires a large cost to achieve this change.
Edit this section
Ii. Basic object-oriented concepts

(1) object.
Objects are all things that people need to study. From the simplest integer to the complex aircraft, they can be regarded as objects. They can not only represent specific things, it can also represent abstract rules, plans, or events.
(2) object status and behavior.
An object has a state, and a data value is used to describe its State.
The object also has operations to change the object state. The object and its operations are the behavior of the object.
Objects combine data and operations to encapsulate data and operations in the unity of objects.
(3) class.
Abstract objects of the same or similar nature are classes. Therefore, the object is abstracted as a class, and the class is embodied as an object. It can also be said that the instance of the class is an object.
A class has attributes. It is an abstraction of the object state and describes the attributes of a class using a data structure.
The class has operations. It is the abstraction of the object's behavior. It is described by the Operation name and the method to implement this operation.
(4) class structure.
There are several classes in the objective world, which have some structural relationships. There are usually two main structural relationships: general-specific structural relationships, and overall-partial structural relationships.
① General: the specific structure is called the classification structure. It can also be called the "or" relation, or the "is a" link.
② Whole-some structures are called assembly structures, and the relationship between them is a kind of "and" relationship, or "has a" relationship.
(5) messages and methods.
The structure for communication between objects is called message. In an object operation, when a message is sent to an object, the message contains the information of the recipient performing an operation. To send a message, you must at least specify the name of the object that receives the message and the name of the message sent to the object (that is, the object name and method name ). It is also necessary to describe the parameters. The parameters can be the names of variables known to the objects that know the message, or the names of global variables that all objects know.
The implementation process of operations in a class is called a method. A method includes a method name, a parameter, and a method body.
Edit this section
3. Object-oriented features

(1) uniqueness of an object.
Each object has its own unique identifier. Through this identifier, you can find the corresponding object. During the entire lifecycle of an object, its identifier remains unchanged. Different objects cannot have the same identifier.
(2) abstraction.
Abstraction refers to abstracting objects with consistent data structures (attributes) and actions (Operations) into classes. A class is such an abstraction, which reflects the important properties related to the application and ignores other irrelevant content. The division of any class is subjective, but it must be related to specific applications.
(3) inheritance.
Inheritance is the mechanism by which child classes automatically share parent class data structures and methods. This is a relationship between classes. When defining and implementing a class, you can base on an existing class and take the content defined by this existing class as your own content, and add some new content.
Inheritance is the most important feature of object-oriented programming languages different from other languages and is not available in other languages.
In the class hierarchy, a subclass inherits only the data structure and method of a parent class, which is called Single-re-inheritance.
In the class hierarchy, child classes inherit the data structures and methods of multiple parent classes, which are called multi-inheritance.
In software development, the inheritance of classes makes the software open and scalable. This is an effective method for information organization and classification. It simplifies the workload of object and class creation, added code reusability.
Inheritance is used to provide a standard class level structure. Through the inheritance relationship of classes, public features can be shared, improving the reusability of software.
(4) polymorphism (polymorphism)
Polymorphism means that the same operation, function, and process can act on multiple types of objects and obtain different results. Different objects receive the same message to produce different results. This phenomenon is called polymorphism.
Polymorphism allows each object to respond to common messages in a suitable way.
Polymorphism enhances software flexibility and reusability.
Edit this section
Iv. Object-oriented Elements

(1) abstraction.
Abstract refers to emphasizing the essence and inherent attributes of an object. In system development, abstraction refers to the meaning and behavior of objects before deciding how to implement objects. Using abstraction can avoid premature consideration of some details.
Class implements the abstraction of object data (that is, State) and behavior.
(2) Encapsulation (Information Hiding ).
Encapsulation is the basis for ensuring excellent controllability of software components.
Object-oriented classes are well-encapsulated modules. class definitions explicitly separate their descriptions (User-visible external interfaces) from implementations (User-invisible internal implementations, its internal implementation provides protection according to its specific scope.
Objects are the most basic unit of encapsulation. Encapsulation prevents changes caused by program dependency. Object-oriented encapsulation is clearer and more powerful than traditional language encapsulation.
(3) Sharing
Object-oriented technology promotes sharing at different levels
Share in the same class. Objects in the same class have the same data structure. These objects share structures and behavioral features.
Shared in the same application. In the class hierarchy of the same application, similar sub-classes with inheritance relationships exist, and data structures and behavior inheritance exist, so that similar sub-classes share the common structure and behavior. Using inheritance to share code is also one of the main advantages of object-oriented.
Shared among different applications. Object-oriented not only allows sharing information in the same application, but also provides conditions for reusable designs for future goals. The library mechanism and structure are used to share information in different applications.
4. Emphasize the object structure rather than the program structure
Iv. object-oriented development methods
At present, the research on object-oriented development methods has become increasingly mature, and many international object-oriented products have emerged. Object-Oriented development methods include Coad, Booch, and OMT.
1. Booch Method
Booch first describes the basic issues of object-oriented software development methods, and points out that object-oriented development is a design method that is fundamentally different from traditional functional decomposition. Object-Oriented Software decomposition is closer to people's understanding of objective transactions, while functional decomposition is obtained only through the conversion of problem spaces.
2. Coad Method
The Coad method is an object-oriented development method proposed by Coad and Yourdon in 1989. The main advantage of this method is that through years of experience in large-scale system development and the combination of object-oriented concepts, a set of system principles are proposed in the identification of objects, structures, attributes and operations. This method further identifies the class and class hierarchy from the perspective of requirements. Although the Coad method does not introduce the terms of Class and Class hierarchies, in fact, it has embodied the characteristics of Class and Class hierarchies in the concepts of classification structure, attributes, operations, and message Association.
3. OMT Method
The OMT method was proposed by James Rumbaugh and other five people in 1991. Its classic book is "Object-Oriented Modeling and design ".
This method is a new object-oriented development method. The basis of the development work is to model objects in the real world, and then use analysis models to design language-independent objects, object-Oriented Modeling and design promotes understanding of requirements and facilitates the development of software systems that are clearer and easier to maintain. This method provides a practical and efficient guarantee for software development in most application fields, and strives to find a practical solution to the problem.
4. UML (Unified Modeling Language) Language
Software Engineering in 1995 ~ In 1997, unprecedented progress was made, surpassing the total achievements in the software engineering field over the past 15 years. One of the most important achievements is the emergence of a Unified Modeling Language (UML. UML will be the leading standard modeling language in the field of object-oriented technology.
UML not only unifies the Expression Methods of Booch, OMT, and OOSE methods, but also makes further development on it, and finally unified it into a standard modeling language accepted by the masses. UML is a well-defined, easy-to-Express, powerful, and universally applicable modeling language. It integrates new ideas, new methods, and new technologies in the software engineering field. Its scope is not limited to support object-oriented analysis and design, but also the entire process of software development starting from requirement analysis.

Author: "thousands of miles"

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.