Refactoring : Improving the Design of Existing Code Hardback
Refactoring is about improving the design of existing code.
It is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure.
With refactoring you can even take a bad design and rework it into a good one.
This book offers a thorough discussion of the principles of refactoring, including where to spot opportunities for refactoring, and how to set up the required tests.
There is also a catalog of more than 40 proven refactorings with details as to when and why to use the refactoring, step by step instructions for implementing it, and an example illustrating how it works The book is written using Java as its principle language, but the ideas are applicable to any OO language.
- Format: Hardback
- Pages: 464 pages, illustrations
- Publisher: Pearson Education (US)
- Publication Date: 28/06/1999
- Category: Software Engineering
- ISBN: 9780201485677
Showing 1 - 5 of 6 reviews.
Previous | Next
Review by akbibliophile
If you write any code at all, anywhere, read this book. Refactoring should be an integral part of all coding efforts, and this book does a marvelous job of conveying the mechanics and theory of such things through clear prose and many examples.
Review by lorin
Refactoring is the act of restructuring source code without changing its behavior: you refactor the code so that it is easier to modify in the future. Fowler describes a number of different kinds of refactorings, with explicit instructions on how to apply these refactorings.
Review by Murdocke23
Very well laid out book. Although it's not a 'read cover to cover' book, the discussions and examples are easy to follow. The first few parts discuss how refactoring is applied and used. the second half, the bulk of the book, covers specific refactorings by category in a templated format. Good reference for those first approaching refactoring or those doing less familiar ones trying something.
Review by momander
This book literally changed overnight the way I write software. The author says we write code primarily for other humans, not for computers. I have heard it before, but this book made me believe it. It doesn't stop there; the author then walks you through exactly how to write code that is easier to read. Looking back at my own code, if it's hard to follow, it's from before I read this book. If it reads like a novel, it's from after.
Review by IvanIdris
Refactoring is the process of rewriting software, without changing the way it functions, in order to improve its readability, testability or maintanability. A book has been written on the subject by Martin Fowler. Some of the chapters were written by other people.“Refactoring: Improving the Design of Existing Code” is focused on OO programming (lots of Java examples) and Agile practices. It is setup as a catalog of refactoring techniques. Each page dedicated to a refactoring is clearly marked, so that you can easily look up a refactoring.The book was written a decade ago. At that time IDE’s did not support advanced refactorings. Most of the methods described are fully automated in modern IDE’s. This means that you don’t have to follow the text that closely any more.1. Refactoring, a First ExampleThe first chapter starts with a simple example. Java code is used throughout the example as well as UML diagrams.2. Principles in RefactoringThe Why and When of refactoring are discussed. Also we get instructions on what to tell our manager about refactoring. This seems a bit silly to me, since I have never had to explain refactoring to my managers.3. Bad Smells in Code“Code Smells” is a frequently used Agile phrase. A phrase I don’t care that much about. Code works or it doesn’t, it can be ugly or unreadable, but it doesn’t smell. The list of “smells” makes sense, however some of the names are downright confusing. For instance, would you be able to tell me what “Refused Bequest” means?4. Building TestsThis chapter talks about JUnit at length. I am sure you are aware that there are many other unit testing frameworks for programming languages other than Java such as PyUnit. We are told that before you start refactoring, you need to have tests. I think it is more of a chicken/egg dilemma. Sometimes you need to refactor first in order to test. Unit tests and functional tests are mentioned. Integration tests, however are completely ignored. How would you know whether the performance and memory usage of your system remained the same? Clearly, this chapter was written by a software developer, and not by somebody who likes breaking applications, I mean testing applications.5. Toward a Catalog of RefactoringsChapter 5 describes the catalog of refactorings to follow. It is the catalog metada in a sense.6. Composing methodsThis chapter is the beginning of the catalog, which forms the “meat” of the book. I am just going to mention a few of the techniques listed in chapter 6.”Extract Method” is one of those refactorings I use on a daily basis. Sometimes things go wrong so we have to do the opposite refactoring “Inline Method”. The author starts using the term “temp” to mean temporary local variables.7. Moving Features Between ObjectsThe author admits that he has trouble assigning responsibilities to objects. We are supposed to fix errors with “Move Method”, “Move Field”, “Extract Class” or other refactorings in this chapter.8. Organizing DataThis chapter discusses a lot of different ways to simplify working with data. For instance, with these refactorings: Replace Data Value with Object Replace Array with ObjectAlso the refactoring “Replace Magic Number with Symbolic Constant” is explained a.k.a “Extract Constant”.9. Simplifying Conditional ExpressionsIn my opinion the refactorings in this chapter need to be renamed. Apart from “Decompose Conditional”, which is clear enough. Although “Breaking up Conditional” might have been better.10. Making Method Calls SimplerMake method calls simpler by renaming them or replacing long parameter lists by objects. The latter technique could be a problem in concurrent programs. It is common to pass immutable values as parameters. You might not be able to replace them by immutable objects.11. Dealing with GeneralizationGeneralization or in OO terms inheritance is a powerful mechanism, that tends to be overused a lot. You can push/pull a method or a field. Inheritance can be replaced by delegation and vice versa.12. Big RefactoringsIn this chapter starts what we can call the “dessert” part. No more simple refactoring recipes. Instead four refactorings that take a considerable amount of time.13. Refactoring, Reuse and RealityThis chapter is an essay on Refactoring by William Opdyke.14. Refactoring ToolsIDE’s have come a long way since this book was written. Most of the issues in this chapter are no longer valid.15. Putting It All TogetherThis final chapter by Kent Beck is a bit mystical and vague. Those are his own words by the way. Some of the points make sense, but the chapter is written too much in a master talking to an apprentice style.The book has a list of soundbites at the end. Literally. The fun thing is that you probably have heard or are going to hear a lot of these soundbites. “Refactoring” is a very useful book, albeit too focused on Java. Most recipes would work for another Object Oriented language. I give this book 5 stars out of 5.
Previous | Next