[ZT] object-oriented: Transition to OO thinking model

Source: Internet
Author: User
Programmers who have been transferred from ASP or VB in the past are certainly not familiar with OO thinking. The idea of starting a project from OO is also a little thunderous, and there is no real adaptation process in mind. Now I want to help you.

In the process of adopting the OO software development method, many people naturally focus on the technical level, for example, using the OO decomposition (object-oriented decomposition) class hierarchy. However, those who prefer the technology tend to ignore the psychological factors behind these technologies, namely, the object-oriented thinking) this is an important factor that many people continue to feel frustrated when adopting the OO method.

OO thinking is the mental operation process of a software engineer, including his views on problem and how to export a solution by understanding the problem) and then express it in an executable software system (working system. Although everyone's thinking patterns are different, the following are the common thinking patterns of OO software engineers ﹕

(1) entity mapping)

First, focus on understanding the entities in the problem domain, and understand the structural nature of each entity, and then correspond to the objects in the software ). For example, the Library's book purchase list and books. It can also be extended to other entities, such as publishers and student courses. OO programmers often learn about the structure and related information of these entities, and then express them as key component in the software ).

This is significantly different from conventional procedural thinking. Traditional thinking focuses on the functions of a software system, and strives to think about the functions that the system should provide and the sequence in which users use these functions. The structure of each object is not often understood in depth. For example, we will give priority to how to deal with the "Book Purchase" function, instead of exploring the structure and related information of book purchase orders.

(2) Abstract action)

Concrete entity in the problem field often inspires a software engineer to discover abstract objects that are more universal ). For example, you can export the library topic (focus subject) and students' reading preferences from the book purchase list.

When a specific object or abstract object is mapped to a software object, you must use the abstract capability to structure the object) hiding and defining abstract interfaces, so that other objects can understand how to use the structure and data of the hidden objects. That is, the abstract interface indicates the Service Project of the object, or behavior ).

As a result, the software engineer can understand the internal structure and behavior of each entity, and then use abstract data type in OO language) in this case, the entity is successfully mapped to the software object.

(3) anthropomophizing)

Objects have behaviors so that they can serve other objects and play a specific role in the organization ). Through anthropomorphic thinking, entities or objects can be seen as wise, well-communicated, and cooperative. In this way, you can assign more roles (Actions) to a software object and present them in the abstract interface of the object. For example, the book purchase list contains a list of books to be purchased (book item) after assigning human resources and considering it as a smart entity, you can ask the list: What is the total amount of books to be bought? The list will ask the book items: What is the unit price? What is the total amount accumulated in the book purchase list? return the answer to you.

Through anthropomorphic thinking, a software engineer can clarify the relationship between software objects, arrange the object role, and define the interface and behavior of the object.

OO thinking helps clarify the relationship between the problem (problem) and the solution, so that the domain expert (end user) can) users can easily understand the organization and usage of the software through their understanding of the problem, and are also keen to participate in the development of the software.

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.