How can programmers output high-quality designs?

Why do programmers design?

作为一名程序员,最理想的状态当然是,产品提需求,UI给设计,程序员哐哐哐敲完代码就完事。然而事实并非如此,要想成为一名工程师,所具备的能力不止于此,不仅仅只是代码的搬运工,还应培养提升自己的综合能力

  • The term "software design" means to conceive, create and invent a set of solutions to transform a computer software requirement specification into a software that can actually run.
  • Design is an activity that combines requirements analysis and coding debugging.
  • In the real world, a key part of a designer's job is to measure conflicting design features and try to find a balance among them.
  • The point of design is partly to create what is possible, and partly to constrain what is possible.

What characteristics should a good design have?

  • The primary goal of minimum complexity design is to minimize complexity. Avoid making "clever" designs, because "clever" designs are often incomprehensible. A simple and understandable design should be made.
  • Maintainability means designing with the programmers doing the maintenance in mind. Keep in mind the questions these maintenance programmers might have about the code you've written. Treat these programmers as your audience, and then design a self-explanatory (self-explanatory) system.
  • Loose coupling means that the various components of the program are designed with minimal correlation. By applying the principles of reasonable abstraction, encapsulation, and information hiding in the class interface, design classes that are as least interrelated as possible. Reducing associations also reduces the workload of integration, testing and maintenance.
  • Scalability means that you can enhance the functionality of the system without destroying its underlying structure. You can change one part of the system without affecting other parts. The more possible changes, the less damage to the system.
  • Reusability means that the components of the designed system can be reused in other systems.
  • High fan-in means having a large number of classes use a given class. This means that the system is designed to make good use of the lower-level utility classes (utility classes).
  • Low fan-out (low fan-out) means that a class uses a small amount or moderate amount of other classes. A high fan-out (more than about 7) indicates that a class uses a lot of other classes and thus may become overly complex.
  • Portability means that the system should be designed so that it can be easily ported to other environments.
  • Simplicity means designing a system with no redundant parts. Voltaire once said that a book is not complete when nothing can be added to it, but when nothing can be taken away. In the software world, this view is even more true, because any redundant code also needs to be developed, reviewed and tested, and reconsidered when other code is modified. Subsequent versions of the software are also backward compatible with this redundant code. Ask this key question: "This is simple, but what does it hurt to add it in?
  • Hierarchy means trying to maintain the hierarchy of each decomposition layer of the system, so that you can observe the system at any level and get a consistent view. The designed system should be able to observe at any level without entering other levels.
  • Standard Technology The more exotic, weird things a system depends on, the more headaches it will be for others trying to understand it for the first time. Try to use standardized and commonly used methods to make the whole system feel familiar.

design template

When you get a function, from what aspects should you write the design? The author gives a design template based on his own experience: if you have no idea or no way to start, you can refer to this template
insert image description here

Guess you like

Origin blog.csdn.net/m0_46627407/article/details/127196475