Reconstruction

xiaoxiao2021-03-06  86

Reconstruction

Updated on Sunday, October 17, 2004

Amassed by Allen Lee

0.0 ... Only a summary browsing list at the beginning, see what you are, you don't have to understand all details. Once you really need to implement a guideline, read it in detail, let it help you. The directory is a chapter with query value, you may not want to read all it once. ...

1.0 ... When you introduce something at first, you should first lectone history, main principles, and more. But every time someone introduces these things on the venue, always induces my sleepy. My thoughts began to wander, my eyes began to blur, until he or she took out instances, I can mention my spirit. The reason why instances can save me with too virtual, because it makes me see the truly travel of things. Talking about the principle, it is easy to flow in general, it is difficult to explain how actually apply. Give an instance, but you can help me understand things well.

1.1 Even so, this program is still working properly. So this is just a judgment in the sense of aesthetics, just a disgusting of ugly code, is it? This is true before we modify this system. The compiler will not care about the code. But when we intend to modify the system, it is involved in people, and people care about this. The poor system is difficult to modify because it is difficult to find the modification point. If it is difficult to find a modified point, the programmer is very likely to make mistakes, thus introducing "bugs".

1.2 Your attitude may tend to "try to modify the procedure as possible": No matter what to say, it is still very good. Your heart keeps in mind the ancient engineering motto: "If he is not bad, don't move it." This program may have not broken yet, but it brings damage. It makes your life more difficult because you find it difficult to complete the changes you need. At this time, the reconstructed technology was debuted.

1.3 If you find that you need to add a feature to the program, the code structure is not very convenient, then reflects the program, making the addition of characteristics easier, then add features.

1.4 Change the variable name Is it worth act? Absolutely worth it. A good code should clearly express your own features, and the variable name is the key to the code. If you want to improve the clarity of the code, you need to modify the name of some things, boldly do it.

1.5 Any fool can write the code that the computer can understand. Only the code that is easy to understand is an excellent programmer.

2.0 From a lot of perspectives, the so-called programming is to talk to a computer. What do you write code tells your computer how your response is an exact action to act as your indication. You have to fill the gap between "what you want to do" and "tell it what". The core of this programming mode is "accurately saying that I want". In addition to the computer, your source code has other readers: There may be another programmer to read your code and make some modifications. We can easily forget the second reader, but he is the most important. Does the computer have spent more than a few hours to compile, what is the relationship? If a programmer spends a week to modify a certain piece of code, then the relationship is great - if he understands your code, this modification is just one hour.

2.1 ... Many times the "future developer" is my own. At this time, the reconstruction is particularly important. I am a very lazy programmer, one of my lazy expressions is: I can't remember the code you wrote. In fact, I don't want to remember anything, because I am afraid of putting my head plug. I always try to write the process in the process, so I don't have to remember it.

2.2 At the beginning I did on the thin branches like this. As the code is getting simpler, I find something you can see some of the design level you can't see. If you don't do these modifications to the code, maybe I will never see them, because my intelligence is not enough to think all this in my mind. Ralph Johnson puts this "early reconstruction" as "wipes the dirt on the window, so that you can see more." 2.3 I am not a great programmer; I am just a good programmer with some excellent habits.

2.4 ... Reconstruction This is not a "special dial time" thing, and the reconstruction should be carried out anytime, anywhere. You should not be refactored to the refactoring, and you are refactored because you want to do anything else, and the reconstruction can help you do things well.

2.5 For the first time, I will take a practical thing to do it; the second time I have a similar situation, but I still do it anyway, you should be reconstructed.

2.6 ... System Today (now) behavior, only part of the whole story, if you don't recognize this, you can't make your programming for a long time. If you "to complete today's task", you can't get tomorrow's mission tomorrow, then you still have failed. However, you know what you need today, but you don't necessarily know what you need tomorrow. Maybe you can guess the needs of tomorrow, maybe, but there is still something that is unexpected.

2.7 We hope that the program: (1) easy to read; (2) All logic is only specified for one place; (3) New changes will not endanger existing behavior; (4) Simple and express conditional logic as possible.

2.8 Of course, many managers say that they "quality drive", in fact, more "progress drivers". In this case, I will give them a more controversial advice: don't tell the manager!

2.9 Progress driver must do as fast as possible, as for how to complete, that is my business. I think the fastest way is to refactor, so I will refactor.

2.10 We know the benefits of reconstruction, we know that the reconstruction can give us a changeable change. But we haven't got enough experience yet, we still can't see its limitations.

2.11 Do not release the interface too early. Please modify your code ownership policies, which is more smooth.

2.12 A clear signal of rewriting (rather than refactoring) is: existing code does not work normally.

2.13 Reconstructing the "Big Bad Software" into "Small Components in Packed".

2.14 If the project has near the deadline, you should also avoid reconstruction. At this time, the productive forces won from the reconstruction process can only be reflected after the final period, and that time is not me. Ward Cunningham has a good view on this. He described unfinished reconstruction work as "debt". Many companies need to take a more effective way to borrow money. However, the "maintenance and extension of the" maintenance and extension of the "maintenance and extension" caused by the payment of the payment is interest. You can take a certain degree of interest, but if the interest is too high, you will be crushed. It is important to manage debt management, and you should pay some debts at any time.

2.15 Even if you fully understand the system, please measure its performance, don't speculate. The assumption will let you learn something, but ten eight nine you are wrong.

2.16 I found that the refactor can help me write faster software. Short range seems to be slower, but it is easier to perform software performance adjustments in the optimization phase. In the end, I still have a head.

4.0 When the number of tests reaches a certain degree, the test efficiency will present a decreasing situation, not persistent increments; if you try to write too many tests, you may also be discouraged because of the workload is too big. You should concentrate the test in a place where you may be wrong. Observe the code, see where it becomes complicated; observation function, thinking what places may be wrong. 5.0 When is it possible to express your own ideas? The earlier, people can use new ideas, new ideas. But as long as it is a person, it is always studying. If you have a half-life unusual idea, these ideas may not be perfect, and may even bring trouble to those who try their people.

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

New Post(0)