Software design specifications

Source: Internet
Author: User
Overview

Software design is the most important part of converting requirements into software systems. The advantages and disadvantages of system design fundamentally determine the quality of software systems.

This article mainly describes five core components of Software System Design: architecture design, user interface design, database design, module design, data structure and algorithm design. It is designed to help developers find out what
"And" how to design ".

Generally, the design process is divided into two phases: the outline design phase and the detailed design phase, as shown below:

  • The focus of the outline design phase is the architecture design.
  • The focus of the detailed design phase is the user interface design, database design, module design, data structure and algorithm design.

Document reduction and process merging can be performed based on the project. For example, there is only one design phase and design document in the project development process.

Architecture

The architecture is like a human skeleton. If a guy's skeleton is a monkey, then no matter how feeding and beauty, this guy is always a monkey and will not become a human.

It can be seen that the architecture is the top priority of system design.

Currently, the most popular software architecture modes include C/S (customer/Server), B/S (Browse/Server), and
Lower-level hierarchy, adjacent ordered hierarchy, and middleware-included hierarchy)

Architecture Design Principles


Suitability

That is, whether the architecture is suitable for the "functional requirements" and "non-functional requirements" of the software ". High levels of designers are high in "designing software that meets the needs of customers ".
And allow developers and clients to obtain the greatest benefit, rather than designing the most advanced software at any cost.


Structural Stability

Work in the detailed design phase, such as user interface design, database design, module design, data structure and algorithm design, is carried out after the system structure is determined,
Programming and testing are more and more subsequent tasks. Therefore, the architecture should be stable for a certain period of time.

The biggest fear of software development is demand changes, but "demand changes" is an unavoidable reality. People hope that when demand changes, it is best
Do some modifications to the software architecture. If the programmer has to modify the software architecture when the demand changes, the system design of the software fails.

High-level designers should be able to analyze demand documents and determine which requirements are stable and which ones may change. Therefore, based on those stable demands
Design the architecture, and design the "scalability" of the software based on the variable requirements ".


Scalability

Scalability refers to the ease of software scaling new features. The better scalability, the stronger the software's ability to adapt to "changes.

Scalability becomes more and more important, which is determined by the business model of modern software:

  • The more developed the business society is, the faster the demand changes. Demand changes will inevitably lead to the modification (or expansion) of software functions, the scale and complexity of modern software is more than ten years
    The previous version is much larger (we can understand the changes in the operating system). If the software has poor scalability, the cost of modifying (or scaling) features will be high.

  • Modern software products usually adopt the "incremental development model". Developers constantly release new software products to continuously obtain value-added profits. If the software has poor scalability
    The price will be very high. Although developers seize the business opportunity, but due to poor design levels and resulting in little profit, it is really necessary to live.


Reusability

From experience, we can see that most of the content in a new system is mature, and only a small part of content is innovative. Generally, you can believe that mature things are always
Relatively reliable (with high quality), and a large amount of mature work can be quickly achieved through reuse (with high productivity ).

Reusability is designed rather than accidental. To make the architecture highly reusable, designers should analyze the common problems of application domains.
Then a general architecture model is designed so that the architecture can be reused.

User interface settings Calculation

In order to improve the ease of use and appearance of the user interface, ten design principles are summarized. There are eight interface design principles for improving ease of use:

  • User Interface is suitable for software functions

  • Easy to understand
  • Consistent Style
  • Timely feedback
  • Error Handling
  • Adapt to various users
  • Internationalization
  • Personalization

The design principles used to improve the aesthetics include:

  • Rational Layout
  • Harmonious colors



User Interface
Functions suitable for Software

The suitability of user interfaces refers to the degree to which interfaces and software functions are harmonious. The functions of the software must be presented through the user interface, which must be suitable for the software.
This is the most basic requirement. The suitability of the interface not only promotes the appearance of the inside world, but also emphasizes the appropriateness.


Easy to understand

Some rules for improving user interface comprehension are as follows:

  • All elements in the interface (such as menus and toolbar) are error-free and will not be misunderstood.
  • All interface elements should provide adequate and necessary prompts. For example, when you move the cursor to an icon on the toolbar, a function prompt should appear next to the icon.
  • The interface structure can clearly reflect the workflow so that users can perform operations step by step.
  • For complex user interfaces, it is best to provide the interface "Wizard" so that users can know their location in the interface structure in a timely manner. For example, for web-based applications, the current bit should be displayed on the interface.
    ", Otherwise, the user will easily lose their way in numerous pages.


Consistent Style

Style consistency has two meanings:

(1)
In a software user interface, similar interface elements should have the same view and operation methods. For example, the command button is the most common interface element, and the shape, color, and response to the mouse of all command buttons
Are consistent.

(2)
User interfaces of the same type of software should have a certain degree of similarity. For example, Microsoft's office family includes Word, Excel, PowerPoint,
Outlook and other software, these software provides the "Copy, cut, paste" function operation methods are the same.


Timely feedback

After a user performs an operation, if the user interface does not respond at all after a while (several seconds), it will make the user feel confused and uneasy, because he does not know
Is your operation wrong or the software causes the crash. So timely feedback is very important. At least let the user know how the task is handled and what results it has.

For example, to download an object, the page should display "percentage" or related numbers to indicate the download progress. Otherwise, people do not know how long to wait. If
Some transactions cannot provide progress and other data, so at least a prompt message should be provided, such as "processing ...", It is best to provide appropriate animations so that users can understand that the software is working and there is no dead end.


Error Handling

When designing the user interface, you must consider error handling so that users do not have to be afraid and careful to avoid making mistakes. Common error handler
Formula:

  • Provides the function of verifying input data. When the user inputs incorrect data, the user is promptly reminded to correct the data.
  • For menu items and command buttons that should not be used in some cases, "invalid" (blocking) can effectively prevent the function from being used incorrectly. For example, for some management software, different users have different operations
    Permissions. If a low-Permission user logs on to the system, the functions that only the advanced-Permission user can use should be blocked (for example, the function becomes "gray" and cannot be operated ).
  • Provides the Undo function to cancel unwanted operations.
  • Prior to performing destructive operations, the user shall be confirmed. For example, when a user deletes an object, a dialog box should be displayed: "Are you sure you want to delete the object?". After the user confirms, the object is deleted.


Rational Layout

First, the layout of the interface should conform to the logic, and it is better to be consistent with the workflow. The interface designer can extract the interface only by carefully analyzing the software requirements.
Valuable layout information.

Secondly, the interface layout should be neat (NEAT and fresh ). The interface elements should be aligned horizontally or vertically, and the spacing between rows and columns should be consistent. Form size
To be appropriate, various controls should not be too crowded or loose. Be good at using the blank spaces of forms and controls and the lines used for separation.


Harmonious colors

Whether the user interface is beautiful depends on the layout and color combination of the interface. It is easier to achieve "rational layout", and it is difficult to design a harmonious layout.
Difficult, because the combination of colors is ever changing, and people's preferences for colors are extremely different.

For the majority of software developers, although we do not have to make the interface of common software beautiful to Windows
XP, but it is undoubtedly very beneficial to master some design principles of interface colors.

  • If you do not want to display realistic images and images, you should limit the number of colors on a single screen because it is difficult for people to remember multiple colors while observing the screen.
  • Colors should be selected based on the importance of objects, and important objects should be marked with eye-catching colors.
  • Consistency should be maintained when the color is used. For example, if the error message is marked in red and the normal information is marked in green, do not use red or green.
  • Do not rely too much on color when expressing information, because some users are blind or weak.
Database Design


Develop platform-independent database applications

Currently, the most widely used database systems in the world include Oracle, DB2, Informix, Sybase, and SQL.
Server.

The fierce competition between these database systems has both advantages and disadvantages. The advantage of competition is that the database system is constantly developed and improved, and the price monopoly is avoided. Competing
The biggest disadvantage of competition is that database vendors are forced to constantly develop unique features to attract more users. Therefore, the unique features of each database system cannot form a unified standard, this makes it difficult for users to develop numbers irrelevant to the platform.
Database applications, because it is difficult for users to resist the temptation of the unique functions of the database system.

Readers may ask: "isn't Structured Query Language (SQL) the standard of the database system ?"

Yes, SQL is the standard query language of the database system. However, database vendors provide many special functions that exceed the SQL standard, which puts people in a dilemma:

  • If you want to make the program irrelevant to the database platform, you can only use SQL and discard the unique features of each database system.
  • If you go beyond SQL and use the unique functions of a database system, such a program is platform-related.
  • Similar problems exist in the operating system and web browser fields. Theoretically, only absolute monopoly can be achieved.
    It is an absolutely unified standard, but people both want to break the monopoly and have unified standards. Such contradictions cannot be completely resolved, but they can only compromise and compromise. The suggestions are as follows:
  • If you develop common database application software and do not want to bind the application software with a specific database system, you can write programs in SQL language honestly.
  • If you are developing industry-specific database application software, and the industry has already specified a database system (this is a common phenomenon of local monopoly), it will not change in recent years, then you can go beyond
    SQL uses the unique features of the database system.


Database performance optimization

The main challenge in database design is "high-speed processing of large-capacity data ". It is a common problem for designers to optimize database performance. Excellent database performance
There are two main ways to improve the efficiency:

  • Optimize the table structure. For example, to normalize the table structure of the third paradigm, the number of table redundancy is allowed.
    To reduce the number of table link operations to improve performance.
  • Optimize the environment parameters of the database. For example, improve hardware facilities and adjust the table space to minimize data fragments.

In the physical design stage of a table, the designer should design the table structure (I .e., normalization) according to the third paradigm ). The advantage of doing so is that there is no redundant data in the table, and the table structure is clear. You can modify or expand the non-square structure in the future.
. However, there are also some shortcomings in the design of the third paradigm: many tables are generated, each table has a relatively small number of columns, and these columns must be associated with "primary/external keys, therefore, a query operation may produce
Complex table links, resulting in lower performance.

Denormalization refers to modifying the table in the third paradigm. By merging tables or creating redundant columns in the table, you can reduce the table link operation cost and improve the performance. It should be noted that anti-Standardization
There is a huge negative impact: It is very troublesome to manage redundant data. If the redundant data is not synchronized, data errors may occur.

Therefore, normalization of the third paradigm of the table is the first important, and anti-normalization should be carefully considered and should not be used too much. "Normalization" and "anti-normalization" are not self-contradictory actions,
Is a performance optimization strategy.

In addition to optimizing the table structure, optimizing the environmental parameters of the database can also improve the database performance. For example, configure a faster CPU for the server and increase the memory. Running databases consumes a lot of memory.
Performance is greatly affected. As memory is getting cheaper on the market, configuring enough memory for the server may be the lowest cost, the lowest difficulty, and the fastest effective performance optimization method.

When installing the database system, specify the block size for the system (the number of bytes designed for a physical read/write operation ). When creating a table, you must specify a certain amount of space for the table. If the "block size" and "tablespace" correspond to the actual
If the data storage does not match, many disk fragments will be generated, which will reduce the performance of database physical operations.

Whether the performance of the application software database can be effectively optimized depends on the developer's familiarity with the database system and development experience.


Database Security Problems

To improve the security of software systems, we should begin with "management" and "technology. Only technical means are considered here (because security management is beyond the scope of Software Engineering
Domain), the general principle is as follows:

  • You can only log on to the application software with an account and access the database through the application software, but there is no other way to operate the database.
  • Encrypt the password of the user account to ensure that no plaintext of the password is displayed anywhere.

Determine the operation permissions of each role on database tables, such as creation, retrieval, update, and deletion. Each role has the right to complete the task.
Less. When a user is assigned a role during the application, the permissions of each user are equal to the sum of permissions of both roles.

Module Design

After the software architecture has been designed, it has been clarified at a macro level what functions each module should have and where it should be placed. We are used
The basic principle of modular design is to divide modules in terms of functions and maintain "function independence. Because the "function Independent" module can reduce the cost of development, testing, maintenance and other stages. However, "function independence" does not mean
Modules must be isolated from each other. To complete a task, a system must cooperate with each other to implement the task. At this time, information exchange is required between modules.

Three Characteristic Factors that evaluate the design of a module: "Information Hiding", "cohesion and coupling", and "closed-openness ".


Information Hiding

In order to avoid interfering with other modules in the same system by the behavior of a module as much as possible, we should pay attention to information hiding when designing modules. Make the module public only
It is necessary to hide all other content from the outside.

Module Information Hiding can be achieved through interface design. Interfaces are the external features of modules and should be made public; while data structures, algorithms, and implementations are Module
Internal features should be hidden. A module only provides a limited number of interfaces. The function of the execution module or information exchange with the module must be implemented only by calling the public interface. If the module is
C ++ object, the public interface of this module corresponds to the public function of the object. If the module is a COM object, the public interface of this module is the interface of the COM object. A com object can
There are multiple interfaces, and each interface is essentially a set of functions.


High Cohesion

Cohesion is a measurement of the degree of association between components in a module. The degree of cohesion is roughly divided into low-end, middle-end, and high-end
End, as shown in Figure 3-15. Module designers do not need to determine the exact level of cohesion. What is important is to strive for high cohesion as much as possible to avoid low cohesion.

Sequential cohesion functional cohesion

Time Series cohesion process cohesion communication cohesion

Occasional cohesion logical cohesion

Low-end... Middle section... High-end...

The meanings of various cohesion types are as follows:

  • Occasional cohesion. If the relationship between components of a module is loose (almost unrelated), it is called contingent cohesion.
  • Logical cohesion. Several logical functions are put in the same module, which is called logical cohesion. For example, a module reads input from various types of peripherals.
  • Time Series cohesion. If several functions in a module must be executed at the same time (such as system initialization), these functions are called time cohesion only because of time factors.
  • Procedural cohesion. If the processing components inside a module are related and the processing must be executed in a specific order, it is called procedural cohesion.
  • Communication cohesion. If all components of a module operate on the same dataset or generate the same dataset, it is called communication cohesion.
  • Sequential cohesion. If the output of a component in a module serves as the input of another component, it is called sequential cohesion.
  • Function cohesion. All components of the module are required to complete a single function, which is called function cohesion.


Low Coupling

Coupling is a measurement of the degree of dependency between modules. Cohesion and coupling are closely related. Strong coupling modules with other modules usually mean
Weak cohesion, while strong cohesion usually means weak coupling with other modules.

Coupling strength depends on the following factors: (1) Number of function calls from one module to another; (2) number of calls from one module to another
Data volume; (3) the amount of control a module applies to another module; (4) the complexity of interfaces between modules.

Coupling levels are roughly divided into low-end, middle-end, and high-end, as shown in 3-16. The module design should strive for "High Cohesion and low coupling" to avoid
"Low cohesion and high coupling ".

Mark coupling control coupling

Public coupling content Coupling

Non-direct coupling data Coupling

Low-end... Middle section... High-end...

The meanings of various coupling types are as follows:

  • Non-direct coupling. There is no direct information transfer between modules, which is called non-direct coupling.
  • Data coupling. Parameters (data) are transmitted between modules through interfaces, which are called data coupling.
  • Tag coupling. It is called stamp coupling. This data structure changes the relevant modules.
  • Control coupling. The module transmits signals (such as switching values and flags) to another module. The module that receives signals adjusts the action according to the signal value, which is called control coupling.
  • Public coupling. Two or more modules reference a global data item, which is called public coupling.
  • Content coupling. When one module directly modifies or operates the data of another module, or directly transfers data to another module, content coupling occurs.
Data Structure and Algorithm Design

Designing efficient programs is based on good data structures and algorithms, rather than programming tips.

Generally, data structures and algorithms are a type of data representation and related operations (here the algorithm is not a numerical calculation algorithm ). From the data representation point of view, an ordered integer table stored in the array is also
A Data Structure. An algorithm is an operation applied to a data structure, such as searching, inserting, or deleting a linear table. If an algorithm can

Constraints) to solve the problem within the range, it is called this algorithm is efficient. For example, a resource limit may be "limited memory used to store data", or
"The time required to execute each subtask is limited ". If an algorithm requires less resources than other known algorithms, this algorithm is also called efficient. The cost of the algorithm (cost) refers to the resource consumed
Source quantity. Generally, the cost is evaluated by a key resource, such as time or space.

There is no doubt that people write programs to solve the problem. Only by pre-analyzing the problem to determine the performance target must be achieved can we hope to select the correct data structure. Many programmers have ignored this analysis.
Process, and directly choose a data structure that they are used to, but is not commensurate with the problem, the result is to design an inefficient program. If you use a simple design to achieve performance goals, you can choose Complex
The data structure is also unreasonable.

People have thoroughly studied common data structures and algorithms, and can summarize some design principles:

1)
Both a data structure and an algorithm have the overhead and benefits of time and space. When faced with a new design problem, designers should thoroughly master how to weigh the time-space overhead and algorithm effectiveness. This requires understanding of algorithms.
Analysis principles, but also need to understand the characteristics of the physical media used (for example, data stored on the disk and stored in the memory, there are different considerations ).

2)
Overhead and earnings are related to time-space trade-offs. In general, we can use a larger time overhead in exchange for the benefits of space, and vice versa. Time-Space trade-offs generally exist in various stages of software development.

3) designers should fully understand some common data structures and algorithms to avoid unnecessary repetitive design work.

4) data structures and algorithms serve applications. We must first understand the needs of the application, and then find or design a data structure that matches the actual application.

The general process of data structure and algorithm design is as follows:

(1) data structures and algorithms are classified into global and local structures. Of course, global structures are designed first, and then local structures are designed later (usually implemented during module design ).

(2) Based on the characteristics of the problem, first find the existing data structures and algorithms and select the most appropriate (not necessarily the most advanced ). If there is no ready-made
So you can design it yourself.

(3) After designing and writing the code, perform the test. If the performance requirements are not met, we need to further optimize the data structure and algorithm.

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.