Intuitive and simple solutions-the eternal pursuit of Software Design

Source: Internet
Author: User

people are good at understanding things in an intuitive and simple way. I firmly believe that, all excellent solutions are intuitive and simple. I like intuitive and simple solutions. Maybe before finding an intuitive and simple solution, we have tried to solve the problem in many complicated and confusing ways. If you cannot clearly explain the Program solution to the green vegetables seller next door in an easy-to-understand manner, this solution is not good enough-it is not simple and intuitive. The universe is complicated enough, But Hawking has created a series of popular science books in the brief history of time. Since it is a popular science, its readers are ordinary people, not necessarily a doctor of physics or astronomy.

In terms of software solutions, in order to pursue an intuitive and simple solution, we have invented object-oriented, then it is the n layer architecture, component-oriented, AOP , also popular MDA and WebService . Everything we do is to simplify complicated problems. This process is an evolutionary process. With the evolution of this process, things are getting closer and closer to their own nature. For example, the data and operation data actions are put together into classes, so that there is a boundary between classes, just like an independent entity in nature, this is a step closer to the nature of things. On the basis of the class, we also split the common behavior according to the common semantics to form an interface, this is like the family of creatures in nature /, which is a step closer to the nature of things. The best future of the entire natural world or the whole human society lies in that every individual can regulate their own behaviors, manage themselves, be responsible for their own behaviors, and send their own information to the outside world in a friendly manner. Isn't this individual a well-designed class? For this bright future, we have added attributes and events to the class so that they do not interfere with other individuals while releasing their own information; we add metadata and reflection capabilities to the class so that it and the outside world can easily obtain their detailed identity information. Later, we separated the business from the basic service (the so-called basic service is like a transaction, thread security, and so on). Separating the business from the basic service has many advantages, first, basic services can be reused in / applications of different projects, this can usually be reused using AOP or components. Second, after the business and basic services are separated, the relationship between them is clearer, so we can focus more on the business, which makes things easier, because we do not need to consider where to insert a lock when implementing a business logic to ensure thread security. Code .

We should all have this experience. When we are not familiar with basic services such as multithreading, networks, and databases, how difficult is it to compile an application server? We often don't know how to do it, let alone about structural design. After gradually familiarizing ourselves with these concepts and practicing them many times, we are confident to implement the business functions of our applications. If we don't need to care about these basic services at all, and we only need to care about the business logic, isn't our confidence even greater? This is because we can have more energy to analyze and understand our business. The more thorough the analysis of our business, the more direct and simple our design will be. This is our goal.

To achieve a simple and direct design, we usually need to pay attention to the following aspects:
(1) The Coupling Degree between components is small. Each component should be self-explanatory, self-describing, and self-sufficient.
(2) the class chart is simple. Pay attention to the volume of classes. The classes that are too large are divided into multiple classes, and the classes that are too tightly coupled are merged into one.
(3) The interaction diagram is simple.
(4) use an appropriate design model. What can be precipitated is always the essence!
(5) reconstruction, reconstruction, and Reconstruction......This is my biggest magic weapon !!!

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.