Based on my request for myself, I have to write some feelings. A number of reading for this book. In fact, it was finished more than a month ago, but this paragraph is busy playing "Xian Three" and helping the wife adults, and there is no sense of "reconstruction".
This book is written on the cover of the "masterpiece with the design pattern", I think it is right to evaluate. This book is on my influence, I am afraid as "design mode". It is especially true that English and it is very easy to understand, even the super weak people like me can read it easily. It also fully reflects the character's literacy.
Write a little thing about the reconstruction.
First, we must know how to do it is a bad code, how to do better. Then I can find a way to make it bad. It is refactoring for a good process that is not good.
The improvement of code quality is a step-by-step process, not the best, only better. Before we refacture, we must weigh the interests and payment of this reconstruction. (As we often do in the trade-off between flexibility and complexity). Usually, in order to achieve new features, it is most important to do.
Speaking of code quality, in fact, people on different levels have different requirements for code quality. As long as the code can run through the code; go back to the encoding specification; to the latter clear readiness; then to the back of the easy change, reuse; Everyone can experience something different from different stages of their own procedures. I have always discovered my shortcomings, reconstructing my code called "self-cultivation." And if there is a level that is better than your high colleague, you can do it, point out where you can improve it, you will do Refactor, you will definitely be faster.
Here, I would like to thank a colleague that I have been helping me to do CodeView. She has a talent that can be keen to discover your shortcomings. Kent Beck is called "Insight", which is insight. Oh, I don't know if this thing grows with work experience. I hope, then I will have this talent one day. :)
Still starting with the beginning of the reconstruction, it is not good to find where the code is not good. It is called "BAD SMELL" in the book. Recall, what is the main there? 1. Long Method, this is where we are most frequently reconstructed. 2, several parts are closely coupled, there is unnecessary dependence. 3. Modifying an item must be coordinated several different places. 4. The duties of the class are not clear, and the logical relationship is confusing. 5, Switch's use. Well, there should be a lot, I can't remember. Yes, there is, "repeat code", remember that some people said that the duplication of the code is the source of the evil. Oh, the evil is the first, and the code is the source. In short, many people are deeply affected. However, I think the problem of repeating code should try to avoid from the start of the code, don't let it go to the reconstruction. That is to say, when you are ready for COPY, Paste, first extract the code to copy into a function.
There is also important point, refactoring must be safe. XP has always emphasized the coding and testing. When you reconstruct a complete unit test support, every step will be very confident, very relieved. But unfortunately, the world has a happiness, and our automatic test is often not so complete. At this time, we must have a complete understanding and grasp of the reconstructed code, and it must be careful. Especially when reconstructing others code, don't change it.
Ok. Time is not early, temporary is these.