Software DesignProgramming Basic Technique (Figure)

xiaoxiao2021-03-06  62

table of Contents

1. When designing the parent class, consider that when designing or writing subclasses, it is found that the parent class needs to be modified, increase the function, etc.

2. Try to avoid writing the same code multiple times

3. Continuous improvement

4. Evaluation of several basic principles of software design

content

1. Software Design / Programming, there is a basic technology called "object-oriented programming". The basic idea of ​​object-oriented programming is subject package and inheritance. The basic idea of ​​inheritance is that all subclasses are partial, extracted, and abstract, in the parent class.

This is a matter of easy and difficult things. The parent class is always designed, first realized. A parent class typically has multiple subclasses. No one can prior her first. When designing the parent class, it is very common to find that the parent class needs to be modified, increase the function, etc. when designing the parent class. For example, Public Class Requestinfo {Public DataItem getdi (String Name) {}}}

Public class DataItem {public string getValue () {}}

When we often write string cycode = info.getdi ("cyccode") == NULL? NULL: Info.getdi ("cycode"). GetValue ();

When we will naturally think, if you add a function getDivalue in Class Requestinfo, you can write a shorter code: string cyccode = info.getdivalue ("cyccode"); this is the benefits, the code is more concise, easier Understand, it is also easier to maintain. The same reason, when we often need to take int value from info, we will naturally know that GetInetValue () should be added to Class Requestinfo.

2. In the process of software development, the most basic principle is to avoid writing the same code multiple times. for example:

This is a very common base class design, considering problems caused by no circumference, each subclass has the same code. The solution is also very simple, and the common part is placed in the base class:

3. The software industry is the same as other industries, and the key is to do quality products, the key is "continuous improvement". Continuous improvement means that if a bad design is found, it should be modified. However, there are many things that don't make simple. For example, a company has two hundred equivalent production lines, and now some people have discovered an improved approach to improve efficiency. We all know that it is impossible to transform all the production lines, which has a big impact on existing production and has a big problem from human material resources. A better way is to adopt new improvement methods for new production lines. The original production line, since it works, it is not necessary to modify it immediately, and can be gradually improved in the future. This example replaces the software industry: a company has two hundred similar software modules / classes (such as XXXBPI), now some people discover a improved approach, write less code in subclasses, improve efficiency, code more Easy to maintain. We all know that it is impossible to transform all XXXBPI at the same time, which has a big impact on existing development and has a big problem from human material resources. A better way is to adopt new improvements for new XXXBPIs. The original code, since it works, it is not necessary to modify immediately, and can be gradually improved later.

Therefore, there are many new and old methods in large software. For example, MS SQL Server, many of the original code is from Sybase purchase, MS technical experts discover some ways to improve performance. After many years, after multiple versions updated, the improved old code is gradually completed. In the open source project, there are also many project version descriptions, and plan to use a certain technology to rewrite the original code. Which modules are currently completed, which modules are planned to increase. Improved and increasing new features will always be carried out. The above example, after the continuous improvement method, becomes the following:

4. Evaluation of several basic principles of software design

Several basic principles of evaluation software design are: easy to understand, easy to use, stability, and function. Easy to understand: VB's users are more than VC, which is easy to understand. People who write design documents with Word are more than people with ROSE, and they are more in Word. It is easy to understand that you can learn to use a shorter time. Easy: If Class A and Class B complete the same function, but use Class A to write less code, we say that Class A is better than Class B. Because using Class A write code, the code is shorter, the development efficiency is higher. The code is easier for future maintenance. Stability, function: Software selling points lies in stability and function. The reason why these two rows behind the front bright items, the same facts are identical: UNIX / Linux stability, the function is more than Windows, but its users are less, the reason is that it is lost in "easy to understand, easy to use" These two tops.

转载请注明原文地址:https://www.9cbs.com/read-119126.html

New Post(0)