Overview
Software design is the most important aspect of demand into software systems. The advantages and indispensation of system design fundamentally determines the quality of the software system.
Here, the five core contents of the software system design are mainly illustrated: architecture design, user interface design, database design, module design, data structure, and algorithm design. It is designed to help developers know "what" design "and" how to design ".
Generally, the design process is divided into two phases: the summary design phase and the detailed design phase, as shown below:
l The focus of the summary design phase is the architecture design.
l The focus of the detailed design phase is the user interface design, database design, module design, data structure and algorithm design.
Document clipping and process merge can be performed according to the situation of the project, such as the project development process has only one design phase and design documentation. 2 architecture architecture is like a human skeleton. If a guy's skeleton is a monkey, then, no matter how to feed and beauty, this guy is always a monkey, will not be a person. It can be seen that the architecture is the weight of the system design. At present, the industry's comparative popular software structural mode has C / S (client / server), B / S (Browse / Server), hierarchy (upper and lower level hierarchical, sequential hierarchical structure, hierarchy of intermediate parts) N System Structure Design Principles u Suitability, is the "functional demand" and "non-functional demand" of the architecture. High-level designers high in "designing software that happens to meet customer needs, and makes the developer and client to get the biggest benefits, rather than at the price design of the most advanced software. U structural stability detailed design stage Work such as user interface design, database design, module design, data structure and algorithm design, etc., are carried out after the architecture determination, and programming and testing is a more work, so the architecture should be within a certain amount of time. Keep stability. The most fear of software development is the change of demand, but "demand will change" is a reality that cannot escape. People hope to make some skin fur, and don't change the software when the demand changes. The architecture of the change software. If the programmer has to modify the software architecture when the demand changes, the system design of this software is failed. High level designers should analyze the demand documentation, which needs to be determined Stable and constant, which needs are possible to change. So according to those stable and unchanging demand design architectures, the "scalability" of the variable demand design software.
u Scalability scalability refers to the advantages of software expansion. The better the scalability, the stronger the software to "change". The scalability is increasing, which is determined by modern software business model: 2 The more developed society, the faster demand changes. Demand variations will result in modifying (or expanding) software functions, modern software size and complexity are much larger than ten years ago (comparison of operating system changes), if the scalability of the software is relatively poor If you modify (or expand) the cost of modifying (or expand).
2 Modern software products usually adopt "incremental development model", developers continue to launch a new version of software products, thereby constantly obtaining value-added profits. If the scalability of the software is poor, the cost of each development of the new version will be high. Although developers caught business opportunities, they did not earn much profit due to poor design level, really to live alive.
U can be reused by experience, usually in a new system, most of the content is mature, only small parts are innovative. Generally, maturity is always relatively reliable (ie, high quality), while a large number of mature work can be quickly implemented (ie, having a high productivity). Recourse is designed, not accidentally encountered. To make the architecture have good reusability, the designer should analyze the commonality issues of the application domain, and then design a universal architectural mode, such an architecture can be reused. 2 User interface Design In order to improve the ease of use and beauty of the user interface, it summarizes ten design principles. The interface design principle for increasing the ease of use is 8: 2 User interface Software Function 2 Easy to understand 2 Style 2 Timely Feedback Information 2 Error Treatment 2 Adapt to Various Users 2 Internationalization 2 Personalization for Improvement The degree design principle is: 2 reasonable layout 2 Harmony color N user interface Software function user interface fit is the degree of integration of interface and software function. The functionality of the software needs to be displayed through the user interface. The user interface must be suitable for software, which is the most basic requirement. The fitness of the interface is both ethics, but also emphasizes justice. n It is easy to understand that some rules that improve user interface understandability are as follows: 2 Interfaces (such as menus, tool bars, etc.) have no errors, nor will people misunderstand. 2 All interface elements should provide sufficient and necessary prompts, such as when the mouse moves to an icon button on the toolbar, the function prompt should appear next to the icon. 2 The interface structure can clearly reflect the workflow so that the user will operate according to the unit. 2 For complex user interfaces, it is best to provide interface "wizard", timely let users know where they are in the interface structure. For example, for web-based applications, "Current Location" should be displayed on the interface, otherwise the user is easily lost in numerous pages. N-style consistent style has two meanings: (1) A software user interface, the same interface element should have the same vision and the same mode of operation. For example, the command button is the most common interface element, the shape, color of all command buttons, and the ability to respond to the mouse is consistent. (2) The user interface of the same type of software should have a certain degree of similarity. For example, Microsoft's Office family has software such as Word, Excel, PowerPoint, Outlook and other software, and the operation of "copying, cut, and paste" functionality provided by these software is the same. n After a timely feedback information, after a certain operation, if you have a point (for a few seconds) user interface, this will make the user feel confused and uneasy, because he doesn't know whether it is wrong or the software is caused. crashed. So timely feedback information is very important, at least let the user have a number, know what this task is handled, what kind of results. For example, a file should be displayed on the interface, and the "percentage" or related numbers should be displayed to represent the progress of the download, otherwise people don't know how much time to wait. If some transaction does not provide progress, then at least give the prompt information such as "Processing, please wait ...", it is best to provide the right animation, so that the user understands that the software is working, no crazy. n Error Treatment must consider error processing when designing the user interface, and the purpose is to let users do not have to avoid mistakes, carefully operate. Common error handling methods are:
2 Provide the function of checking the input data. When the user enters the wrong data, promptly remind the user to correct the data.
2 For menu items and command buttons that should not be used in some cases, "fail" (shield) can effectively prevent the function from being incorrectly used. For example: For some management software, different users have different operational permissions. If the low permissions are logged in to the system, those features that only advanced privileges can use should be blocked (e.g., "gray" is not operable).
2 Provide UNDO function to revoke undesirable operations.
2 Before performing the destructive operation, the user should obtain the user's confirmation. For example, when the user deletes a file, the dialog should be popped up: "Do you really delete this file?", When the user is confirmed, it really deletes the file.
n Rational layout First, the layout of the interface should meet logic, it is best to match the workflow. Interface designers can only extract valuable information on interface layout only if they carefully analyze the needs of software. Second, the layout of the interface should be neat (neatly refreshing). The interface element should be aligned in horizontal or vertical direction, and the spacing of the column is consistent. The size of the form should be suitable, and various controls cannot be overcrowded or too loose. Be good at using the blank of the form and control, as well as the lines of splitting. N harmonious color user interface is beautiful, depending on the layout and color matching of the interface. Realizing "reasonable layout" is relatively easy, the color of design and harmonious color is too difficult, because the color combination is ever-changing, and people are also extremely different. For the majority of software developers, although we don't have to make the interface of ordinary software appear to Windows XP, it is undoubtedly very beneficial to master some interface color design principles. 2 If it is not to show the realistic graphics and images, the number of color of the screen should be limited because people have difficult to remember a variety of colors at the same time when they observe the screen. 2 The color should be selected based on the importance of the object, and important objects should be represented by a striking color. 2 Should be consistency when using color, such as the error prompt information is represented by red, and the normal information is indicated by green, then don't happen to red and green. 2 Do not excessively dependent on color when expressing information, because some users are color blind or weak.
2 Database Design N Development and Platform Non-related Database Applications At present, the most widely used database system internationally has Oracle, DB2, Informix, Sybase, and SQL Server. The fierce competition between these database systems is beneficial and harm. The advantage of competition is to make the database system continue to develop and improve, and avoid price monopoly. The biggest and harm of competition is to force the database manufacturers to continue to develop unique features to attract more users, so the unique features of each database system cannot form a unified standard, causing users to develop database applications that are unrelated to the platform, because users are difficult The temptation to resist the unique function of the database system. The reader may ask: "Is it a standard query language (SQL) is not the standard of the database system?" Yes, SQL is the standard query language of the database system. However, database vendors provide too many features that exceed SQL standards, so that people have fallen into two difficulties: 2 If you want to make the program and database platforms, you can only use SQL to give up the unique features of each database system. 2 If you go beyond SQL, use a unique function of a database system, then such a program is related to the platform. Similar problems also exist in operating systems, web browsers. In theory, only absolute monopoly can form absolute uniform standards, but people want to break the monopoly and hope to have unified standards, this contradiction cannot be completely solved, can only be compromised, compromise. The recommendation is as follows: 2 If you develop a general database application, do not want the application to bundle with a specific database system, then you will write a program in the SQL language. 2 If you develop industry-specific database applications, and this industry has specified database system (this local monopoly phenomenon is generally existed), there will be no change in the year recently, then you can transcend SQL use the database system. Unique function. n Database Performance Optimization Problem Database Design The main challenge is "data from high speed processing." How to optimize the performance of the database is a problem that designers are often facing. There are two main ways to optimize database performance: • Optimize the table structure itself. For example, the table structure of the third paradigm is reversely processed, allowing the table to be stored in redundant data, thereby reducing a plurality of table link operations to achieve the purpose of improving performance. • Optimize the environmental parameters of the database. For example, improve hardware facilities, and adjust the space of the table to minimize data fragments. In the physical design phase of the table, the designer shall design the table structure (ie standardized processing) in accordance with the third paradigm. The benefits of doing this are: there is no redundant data in the table, the table structure is very clear, and it will be modified or expanded in the future. However, there are also some shortcomings in the third paradigm design: there are many tables, each having a relatively few columns, and these columns must be associated with "master / external health", so a query operation may result in complexity The table link leads to a decrease in performance. The reverse standardization process refers to a modification of the table of the third paradigm. By merging some tables, or creating redundant columns in the table, reducing the purpose of the table link operation is reduced to improve performance. It should be noted that the anti-conventional process has a great negative impact: managing redundant data is cumbersome, if the redundant data is not synchronized, there will be a serious problem with data errors. Therefore, the standardization treatment of the third paradigm is the first important, and the anti-sective processing needs to be careful, it should not be used too much. "Standardized Processing" and "reverse standardization process" are not a strategy for performance optimization. In addition to optimizing the table structure, the environmental parameters of the database can also improve the performance of the database.
For example, a faster CPU is configured to add memory. Running the database is very consuming memory, and the memory is relatively large for database performance. Since the memory is now getting cheaper, it is probably the lowest cost, the lowest performance optimization method for the server. When installing a database system, you want to specify "block size" for the system (the number of bytes designed at a physical read and write operation). When you create a table, you must specify a certain space for the table. If "block size" and "table space" do not match the actual data storage, there will be many disk debris, which will reduce the performance of the database physical operation. Can effectively optimize the performance of the application software database, depending on the developer's familiarity and development experience. n Database security issues improve the security of the software system should start from "management" and "technology". Here only considers technical means (because security management exceeds software engineering categories), the general principles are as follows: • Users can only log in to the application with an account, access the database through application software, without other ways to operate the database. • Encrypt the password of the user account to ensure that the text will not appear in any place. Determine each role to the operation permission of the database table, such as create, retrieve, update, delete, etc. Each role has the permissions that are enabled by the task, not much. The role is assigned to the user when applying, then the permissions of each user are equal to the sum of the rights he also role. 2 module design
After designing the software architecture, it has already clarified what features should be made in macro, which should be placed in the architecture. We are used to dividing the modules from functional, maintaining "function independence" is the basic principles of modular design. Because "Function Independence" modules can reduce the cost of development, test, maintenance. But "function independent" does not mean that the module remains absolutely isolated. A system is to complete a task, requiring each module to match each other, and the module is to communicate with information. Three feature factors for evaluation module design: "Information Hide", "Coinage and Coupling" and "Closed - Openness". n Information Hide To try to avoid the behavior of a module to interfere with other modules in the same system, pay attention to information hide when designing modules. You should let the module only openly to let the outside world know, and hide all other content. The information hidden by modules can be implemented by interface design. The interface is an external feature of the module, which should be disclosed; and the data structure, algorithm, implementation body, etc. is the internal characteristics of the module, should be hidden. One module only provides a limited interface (interface), the function of executing the module or the module communication information must be implemented, and only by calling the public interface. If the module is a C object, the public interface of the module corresponds to the public function of the object. If the module is a COM object, the public interface of the module is the interface of the COM object. A COM object can have multiple interfaces, and each interface is substantially a collection of some functions. N high-polypolymerous cohesion is a measure of the degree of correlation between the components of the module. The degree of cohesive is from low to high into low-end, medium and high ends, as shown in Figure 3-15. The module designer does not necessarily determine the exact level of the consolidation, it is important to try to strive for high cohes and avoid low cohesion.
Sequential cohesive function
Time-sequential cohesive internal polyvantage
Characteristic luminance logic
Low-end ... medium section ... high-end ...
Figure 3-15 Schematic of "Object"
The meanings of various cohesive types are as follows:
2 Characterinity. If the relationship between the respective components of a module is loose (almost unrelated), it is called an incidental cohesion. 2 Logic cohesive. Several logical related features are placed in the same module, referred to as logic cohesion. For example, a module reads inputs for various types of peripherals.
2 Time-in-order cohesion. If several features within a module must be executed in the same time (such as system initialization), these functions are only because the time factors are associated, referred to as timecaster.
2 Process cohesion. If the processing component inside one module is related, and these processing must be performed in a specific order, referred to as process cohesion.
2 Communication consolidation. If all of the components of a module operates the same data set or generates the same data set, it is called communication.
2 Order. If the output of a component in the module is input as the input of another component, it is called the order.
2 Functional. All components of the module are required to complete a single function, referred to as functional cohesion.
N low-coupled coupling (coupling) is a measure of dependence between the modules. Neglocity and coupling are closely related, and a strong coupled modules in other modules typically mean weak cohesive, and strongly coated modules typically mean weak coupled between other modules. The intensity of the coupling depends on the following factors: (1) a module calls the number of function calls another module; (2) A module passes the amount of data to another module; (3) a module applied to another module How much; (4) The complexity of the interface between the modules.
The degree of coupling is from low to high to low end, medium or high end, as shown in Figure 3-16. The module design should strive for "high polymerization, low coupling", and avoid "low polymerization, high coupling".
Diagram coupling control coupling
Public coupling content coupling
Non-direct coupling data coupling
Low-end ... medium section ... high-end ...
Figure 3-16 Schematic of "Coupling Spectrum"
The meaning of various coupling types is as follows:
2 Non-direct coupling. There is no direct information transfer between the modules, called non-direct coupling.
2 Data coupling. Parameters (data) are transmitted between the modules, called data coupling.
2 Tag coupling. The module passes a part of the internal data structure (not a simple parameter), referred to as a print (STAMP) coupling. The change in this data structure will make the associated module change.
2 Control the coupling. Module delivery signals (such as switching value, flag, etc.) give another module, the module of the received signal is adjusted according to the signal value, referred to as a control coupling.
2 Public coupling. More than two modules collect a global data item called public coupling.
2 Content coupling. Content coupling occurs when a module changes or operates another module or directly into another module.
2 Data Structure and Algorithm Design High Efficiency Program is based on a good data structure and algorithm, not based on programming tips. Generally speaking, the data structure and algorithm are representative of a class of data and their related operations (here the algorithm is not calculated by index value). From the viewpoint of data representation, an ordered integer table stored in an array is also a data structure. Algorithm is some operations applied to data structures, such as retrieving, inserting, deleting, etc. for a linear table. An algorithm solves the problem in the range of resource constraints, saying that this algorith is efficient. For example, a resource limit may be "limited to storage data is limited", or "allowing the time required to perform each sub-task". An algorithm is less than the resources needed than other known algorithms, which is also known as efficient. The cost of the algorithm (COST) refers to the amount of resources consumed. In general, the price is assessed by a critical resource such as time or space. Undoubtedly, people's writing programs are to solve the problem. Only by pre-analyzing the problem to determine the performance goals that must be achieved, there is a wish to pick the correct data structure. There are quite a few programmers ignore this analysis process, and directly use a certain amount of use, but the data structure that is not commensurate with the problem, and it is designed to design a low efficiency program. If you use a simple design to achieve performance goals, it is not reasonable to use complex data structures. The research on common data structures and algorithms can be quite thorough, and some design principles can be summarized: 1) A data structure and algorithm have their time, space overhead and benefits. When facing a new design problem, the designer must thoroughly understand how to weigh the time and space overhead and the effectiveness of the algorithm. This requires understanding the principles of algorithm analysis, but also needs to understand the characteristics of the physical media used (for example, data stored on disk and stored in memory, there are different considerations). 2) The overhead and revenue is related to the time - the trade-off of space. You can usually use a greater time overhead to exchange the gains 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 duplicate design work. 4) Data structure and algorithm are application services. We must first understand the needs of the application, look for or design the data structure that matches the actual application. The general process of data structure and algorithm is as follows:
(1) The data structure and the algorithm have global and partial points, of course, first design the overall design, and is local (usually in the module design). (2) According to the characteristics of the problem, look for the existing data structure and algorithm, and select the most appropriate (not necessarily the most advanced). If there is no ready-made, then you can design it. (3) After designing and writing code, you should test. If you do not meet performance requirements, then further optimize data structure and algorithms.