Create a good design code
The design is not to make the code perfect, and it does not exist in this world. Design is a higher requirement on the basis of implementation. Write software, first of all, is of course giving people, that is, implementation. Then, it is to facilitate yourself or others understand and maintain, this is the purpose of design. A well-designed code is more likely to be understood, maintained, and is reused. The end result of these benefits is that it can greatly reduce the development cost and accumulate some reusable codebases. How to create a good design code? First, establish a writing program is a belief in the artistic creative process. Programmers need to have a little faith. For example, complete a algorithm, the writing of the code is thousands of change, you can write very bad, you can write it with your ability. In general, the writing code is faster, and the boss may only care about what the function you have made is not concerned. Write code may be easier to please the boss, and the subsequent maintenance work is not necessarily made by you. However, in this case, I think the programmers I am, it will not choose the write code crossing. This is a kind of belief, the code writes, you have to get yourself, you have to say anyone else, "This is the procedure I wrote!" Although it is often possible to hear the "programmer is just a code worker", "people in India are high school student write code". However, the code worker is just a programmed machine, there is no idea, only know how to implement, that is CODER, Coding Machine. And the faith tells us, what we have to do is Programmer or even Designer! Programmers should be thoughtful, they will use code to express themselves. The programmer will use the program as its own work, and it is willing to refine it in the case of time. And the programmer more believes that the beautiful code is enough to make people prolong life! Second, learn to continue reflect, summarize, accumulate experience. A good design is not a matter, it is necessary to constantly adjust and reconstruct the original design. The initial design is often thinking about it, and with the development of development, it may discover the unreasonable design of the design over the development of the demand. At this time, don't hesitate, immediately pull the code to better direction, and the so-called "unreasonable". Because of the initial poor design, with the expansion of the entire project code, it will be enlarged at a geometric level. If the original code is not allowed, it cannot continue to continue to the end of the project, which is the most deadly. Finally, it is necessary to constantly learn from others' experience. People who have seen the book "Design Mode" will sigh for the results of the ancestors. Perhaps the reader will find that some of these modes have actually been used or being used. "Mode" is such a design experience that is practiced by many systems, many people. Learn these, you can stand on the shoulders of yourself; then, even in the process of writing a lot of code, you can also put some of the techniques used to be used in the design, sorting into a pattern - this Also a reuse. The easiest way to learn others is to read some classic code and related books. For example, the code of the VCL library itself is a good example. In terms of books, most books involving OOP design are in C to tell the language, and very small, this is exactly why it is proposed in Chapter 1 in this book, "Really clever programmer C is understood from Delphi.