

Changes for 2nd Edition of Refactoring
source link: https://www.tuicool.com/articles/hit/ANzuQfA
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Changes for the 2nd Edition of Refactoring
A short summary of the changes between the first and second editions of Refactoring
05 September 2018
At the broadest level, the second edition's structure follows that of the first edition. That shouldn't be too surprising, since the first edition was so successful, I might as well continue with what worked.
The first edition opened with four narrative chapters, these all appear the second edition too. All of these follow the broad forms of the original book.
The opening example shifts its domain, as not that many people are familiar with a video store any more. The flow of the refactorings is pretty much the same: break into functions, separate calculation from formatting, organize calculations by type using polymorphism.
The principles and smells chapter both had a thorough overhaul. There's much that survived and much that changed. I'm guessing about three-quarters of it changed, but that's a gut feel rather than based on a realistic measurement. The testing chapter had to be completely redone, particularly due to change from Java to JavaScript.
After those introductory chapters, I continue with the catalog, which I've always seen as the heart of the book. I'll go into the catalog changes in more detail in a moment, but one notable structural change is I put together an initial chapter of refactorings that contains what I judge to be a good set of refactorings to learn about first.
I dropped the later chapters, which explored some more tangential issues. I think they worked in the first edition, but these days I think it's better to publish essays like this on my website. That's the same reason why I also dropped the four "big refactorings" from the catalog. The big refactorings were always a bit different to the majority of the refactorings, and I do feel these examples work better through essays on my website.
Changes to the catalog
So what happened to the catalog? Here's a table that shows the fate of the original 68 refactorings.
† web edition only
Refactorings marked as kept are present in the second edition under the same name. Those marked as absent, aren't in the new edition. There are various reasons I dropped refactorings from the new edition, and I may extend this article to discuss some of these in the future. Those marked replaced have a refactoring with a different name in the new editions. Some of these are little more than a rename, for example I changed "Split Temporary Variable" with "Split Variable". Most are minor generalizations, such as changing "Extract Method" to "Extract Function". Many of these generalizations reflect the less object-centric nature of the rewrite. In some cases a few first edition refactorings are combined: eg Add Parameter, Remove Parameter, and Rename Method are all replaced by Change Function Declaration. As with the ones that I left out, I may extend this article in the future to discuss some individual cases.
The new edition contains fifteen refactorings that are completely new, in that they aren't generalizations or renaming of existing refactorings. These are:
Combine Functions into Class Combine Functions into Transform Move Statements into Function Move Statements to Callers Remove Dead Code Rename Field Rename Variable Replace Command with Function Replace Derived Variable with Query Replace Inline Code with Function Call Replace Loop with Pipeline Replace Query with Parameter Replace Subclass with Delegate Return Modified Value Split PhaseI realize that the names alone don't convey that much about what these new refactorings do, or how the generalized refactorings differ from what's in the first edition. In due course I'll be updating the online catalog to give more information on this.
Recommend
-
136
Code Examples: Mastering Bitcoin Mastering Bitcoin is a book for developers, although the first two chapters cover bitcoin at a level that is also approachable to non-programmers. Anyone with a basic understanding of technology ca...
-
88
I've been working on a second edition of "Refactoring". Our target is to have it published in the fall of 2018.
-
58
99 Bottles of OOP is a practical guide to writing cost-effective, maintainable, and pleasing object-oriented code. It explores: Recognizing when code is "good...
-
14
-
7
Global Warming: Understanding the Forecast, 2nd EditionSkip to main content ...
-
10
Book description Systems programming provides the foundation for the world's computation. Developing performance-sensitive code requires a programming language that puts programmers in control of how memory, processor time, and...
-
12
Systems Performance: Enterprise and the Cloud, 2nd Edition (2020)
-
8
Announcing “Code” 2nd Edition June 10, 2022Ros...
-
2
“Code” 2nd Edition Now Available! August 7, 2022...
-
6
SASE For Dummies 2nd Edition...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK