Design principles applicable to all regions (1)

Source: Internet
Author: User

Design principles applicable to all regions (1)

One design is suitable for one project but not necessarily for another project. It is unrealistic to grasp the various designs applicable to each project. Experience tells us that using rules can help our brain take control of more things. Similarly, with the help of design principles, we will be able to better control the software design. Once you master certain design principles, whatever project you do, using them will help you make (better) a good design.

Because the design principle has a certain degree of abstraction, its role in design is still guiding. The same design principle may have different effects in different projects. to properly use the principles, you need to constantly think about and practice. Is it possible to hit prey with a gun? No gun practice. A gun is just a gun rather than a real hunting tool.

The following describes some of the design principles that the author often uses in his work and provides design examples to help readers understand them. Since the principles of consistency and integrity were not met during the creation of this book, they were not written into this book. In the future, I will share with you the appropriate materials through my blog.

People-oriented

In section 13.1, it is pointed out that software design is a process of creating models. When creating models, we should take the real world as a reference. This is the specific meaning of people-oriented design principles.

In addition to meeting the requirements it should meet, the software is designed to convey the design intent to others. A design cannot be maintained by one person forever, which leads to the communication problem between the designer and the successor. There are many forms of communication, such as document writing and verbal communication. But the most effective way of communication is to allow the design itself to have a "self-explanatory" ability.

We have accumulated a lot of life experience in real life, which brings great efficiency to communication. For example, when it comes to knives, everyone can immediately understand what a knife is, without the need to interpret it as "a tool made of iron for cutting things ". Since life experiences are so important to communication efficiency, the models created in the software world at design time should cater to people's life experiences. If we design a knife in the software world as a tool for screw screwing, it seems a little weird, because it is totally different from our common sense of life.

The contents of books such as data structures are mainly based on the software world, which is the cornerstone of the Software world and effective for communication between software development engineers, But Not vivid enough, not enough expressiveness. Design should reflect the real world in the software world as much as possible. Only in this way can it be more vivid and easy to understand. The software designed based on the people-oriented design principle can be used to let people know about it and then predict it based on their own experience. This will obviously greatly improve the "self-explanatory" capability of the software to be designed.

The following uses a memory management unit to protect the task memory pool in the VxWorks operating system as an example to help readers better understand the "people-oriented" design principle.

Assume that there are multiple tasks on an embedded device running the VxWorks operating system, and all tasks run in the way of sharing system memory, that is, even the dedicated memory pool Task B of task A can be accidentally accessed due to an error. Implementing memory pool protection by using memory management units (see section 1.10) will help prevent illegal memory pool access problems caused by Uninitialized pointers and other factors in the program. Before exploring the design scheme, you must first understand the use case ).

Figure 13.3 illustrates three tasks and three memory pools. Each memory pool also identifies which (some) task can be read and written. When task a is active (Note: Only one task can be active at each time point), the memory pool 1 and 2 can be read and written, and the memory pool 3 cannot; similarly, when Task B is in the active state, the memory pool 2 and 3 will become readable and writable, but the memory pool 1 cannot. Finally, when task C is in the active state, neither of the three memory pools can be read or written.

 

 

 

According to the "people-oriented" design principle, we need to find similar scenarios in our life that can express this design case and introduce it into the software world. Many companies have employee cards and their cards are associated with the company's access control system. Each person can access the company's office areas or laboratories for permission management through employee cards. If we move the real model of employee cards to the software world, we will be able to provide a good "self-explanatory" capability for the final design results.

 

This article is based on the book professional embedded software development-advanced and efficient programming (including one DVD)

Book details: http://blog.csdn.net/broadview2006/article/details/7089444

 

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.