
Amazon Prime Free Trial
FREE Delivery is available to Prime members. To join, select "Try Amazon Prime and start saving today with FREE Delivery" below the Add to Cart button and confirm your Prime free trial.
Amazon Prime members enjoy:- Cardmembers earn 5% Back at Amazon.com with a Prime Credit Card.
- Unlimited FREE Prime delivery
- Streaming of thousands of movies and TV shows with limited ads on Prime Video.
- A Kindle book to borrow for free each month - with no due dates
- Listen to over 2 million songs and hundreds of playlists
Important: Your credit card will NOT be charged when you start your free trial or if you cancel during the trial period. If you're happy with Amazon Prime, do nothing. At the end of the free trial, your membership will automatically upgrade to a monthly membership.
Buy new:
-26% $47.84$47.84
Ships from: Amazon Sold by: North Books
Save with Used - Good
$9.84$9.84
Ships from: Amazon Sold by: Dream Books Co.

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Refactoring: Improving the Design of Existing Code Edition Unstated
Purchase options and add-ons
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.
- ISBN-100201485672
- ISBN-13978-0201485677
- EditionEdition Unstated
- PublisherAddison-Wesley Professional
- Publication dateJanuary 1, 1999
- LanguageEnglish
- Dimensions1 x 7.5 x 9.25 inches
- Print length431 pages
There is a newer edition of this item:
Frequently bought together

Customers who viewed this item also viewed
Editorial Reviews
Amazon.com Review
Besides an introduction to refactoring, this handbook provides a catalog of dozens of tips for improving code. The best thing about Refactoring is its remarkably clear presentation, along with excellent nuts-and-bolts advice, from object expert Martin Fowler. The author is also an authority on software patterns and UML, and this experience helps make this a better book, one that should be immediately accessible to any intermediate or advanced object-oriented developer. (Just like patterns, each refactoring tip is presented with a simple name, a "motivation," and examples using Java and UML.)
Early chapters stress the importance of testing in successful refactoring. (When you improve code, you have to test to verify that it still works.) After the discussion on how to detect the "smell" of bad code, readers get to the heart of the book, its catalog of over 70 "refactorings"--tips for better and simpler class design. Each tip is illustrated with "before" and "after" code, along with an explanation. Later chapters provide a quick look at refactoring research.
Like software patterns, refactoring may be an idea whose time has come. This groundbreaking title will surely help bring refactoring to the programming mainstream. With its clear advice on a hot new topic, Refactoring is sure to be essential reading for anyone who writes or maintains object-oriented software. --Richard Dragan
Topics Covered: Refactoring, improving software code, redesign, design tips, patterns, unit testing, refactoring research, and tools.
From the Inside Flap
Once upon a time, a consultant made a visit to a development project. The consultant looked at some of the code that had been written; there was a class hierarchy at the center of the system. As he wandered through the hierarchy, the consultant saw that it was rather messy. The higher-level classes made certain assumptions about how the classes would work, assumptions that were embodied in inherited code. That code didn't suit all the subclasses, however, and was overridden quite heavily. If the superclass had been modified a little, then much less overriding would have been necessary. In other places some of the intention of the superclass had not been properly understood, and behavior present in the superclass was duplicated. In yet other places several subclasses did the same thing with code that could clearly be moved up the hierarchy.
The consultant recommended to the project management that the code be looked at and cleaned up, but the project management didn't seem enthusiastic. The code seemed to work and there were considerable schedule pressures. The managers said they would get around to it at some later point.
The consultant had also shown the programmers who had worked on the hierarchy what was going on. The programmers were keen and saw the problem. They knew that it wasn't really their fault; sometimes a new pair of eyes are needed to spot the problem. So the programmers spent a day or two cleaning up the hierarchy. When they were finished, the programmers had removed half the code in the hierarchy without reducing its functionality. They were pleased with the result and found that it became quicker and easier both to add new classes to the hierarchy and to use the classes in the rest of the system.
The project management was not pleased. Schedules were tight and there was a lot of work to do. These two programmers had spent two days doing work that had done nothing to add the many features the system had to deliver in a few months time. The old code had worked just fine. So the design was a bit more "pure" a bit more "clean." The project had to ship code that worked, not code that would please an academic. The consultant suggested that this cleaning up be done on other central parts of the system. Such an activity might halt the project for a week or two. All this activity was devoted to making the code look better, not to making it do anything that it didn't already do.
How do you feel about this story? Do you think the consultant was right to suggest further clean up? Or do you follow that old engineering adage, "if it works, don't fix it"?
I must admit to some bias here. I was that consultant. Six months later the project failed, in large part because the code was too complex to debug or to tune to acceptable performance.
The consultant Kent Beck was brought in to restart the project, an exercise that involved rewriting almost the whole system from scratch. He did several things differently, but one of the most important was to insist on continuous cleaning up of the code using refactoring. The success of this project, and role refactoring played in this success, is what inspired me to write this book, so that I could pass on the knowledge that Kent and others have learned in using refactoring to improve the quality of software. What Is Refactoring?
Refactoring 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. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.
"Improving the design after it has been written." That's an odd turn of phrase. In our current understanding of software development we believe that we design and then we code. A good design comes first, and the coding comes second. Over time the code will be modified, and the integrity of the system, its structure according to that design, gradually fades. The code slowly sinks from engineering to hacking.
Refactoring is the opposite of this practice. With refactoring you can take a bad design, chaos even, and rework it into well-designed code. Each step is simple, even simplistic. You move a field from one class to another, pull some code out of a method to make into its own method, and push some code up or down a hierarchy. Yet the cumulative effect of these small changes can radically improve the design. It is the exact reverse of the normal notion of software decay.
With refactoring you find the balance of work changes. You find that design, rather than occurring all up front, occurs continuously during development. You learn from building the system how to improve the design. The resulting interaction leads to a program with a design that stays good as development continues. What's in This Book?
This book is a guide to refactoring; it is written for a professional programmer. My aim is to show you how to do refactoring in a controlled and efficient manner. You will learn to refactor in such a way that you don't introduce bugs into the code but instead methodically improve the structure.
It's traditional to start books with an introduction. Although I agree with that principle, I don't find it easy to introduce refactoring with a generalized discussion or definitions. So I start with an example. Chapter 1 takes a small program with some common design flaws and refactors it into a more acceptable object-oriented program. Along the way we see both the process of refactoring and the application of several useful refactorings. This is the key chapter to read if you want to understand what refactoring really is about.
In Chapter 2 I cover more of the general principles of refactoring, some definitions, and the reasons for doing refactoring. I outline some of the problems with refactoring. In Chapter 3 Kent Beck helps me describe how to find bad smells in code and how to clean them up with refactorings. Testing plays a very important role in refactoring, so Chapter 4 describes how to build tests into code with a simple open-source Java testing framework.
The heart of the book, the catalog of refactorings, stretches from Chapter 5 through Chapter 12. This is by no means a comprehensive catalog. It is the beginning of such a catalog. It includes the refactorings that I have written down so far in my work in this field. When I want to do something, such as Replace Conditional with Polymorphism (255), the catalog reminds me how to do it in a safe, step-by-step manner. I hope this is the section of the book you'll come back to often.
In this book I describe the fruit of a lot of research done by others. The last chapters are guest chapters by some of these people. Chapter 13 is by Bill Opdyke, who describes the issues he has come across in adopting refactoring in commercial development. Chapter 14 is by Don Roberts and John Brant, who describe the true future of refactoring, automated tools. I've left the final word, Chapter 15, to the master of the art, Kent Beck. Refactoring in Java
For all of this book I use examples in Java. Refactoring can, of course, be done with other languages, and I hope this book will be useful to those working with other languages. However, I felt it would be best to focus this book on Java because it is the language I know best. I have added occasional notes for refactoring in other languages, but I hope other people will build on this foundation with books aimed at specific languages.
To help communicate the ideas best, I have not used particularly complex areas of the Java language. So I've shied away from using inner classes, reflection, threads, and many other of Java's more powerful features. This is because I want to focus on the core refactorings as clearly as I can.
I should emphasize that these refactorings are not done with concurrent or distributed programming in mind. Those topics introduce additional concerns that are beyond the scope of this book. Who Should Read This Book?
This book is aimed at a professional programmer, someone who writes software for a living. The examples and discussion include a lot of code to read and understand. The examples are all in Java. I chose Java because it is an increasingly well-known language that can be easily understood by anyone with a background in C. It is also an object-oriented language, and object-oriented mechanisms are a great help in refactoring.
Although it is focused on the code, refactoring has a large impact on the design of system. It is vital for senior designers and architects to understand the principles of refactoring and to use them in their projects. Refactoring is best introduced by a respected and experienced developer. Such a developer can best understand the principles behind refactoring and adapt those principles to the specific workplace. This is particularly true when you are using a language other than Java, because you have to adapt the examples I've given to other languages.
Here's how to get the most from this book without reading all of it.
If you want to understand what refactoring is, read Chapter 1; the example should make the process clear. If you want to understand why you should refactor, read the first two chapters. They will tell you what refactoring is and why you should do it. If you want to find where you should refactor, read Chapter 3. It tells you the signs that suggest the need for refactoring. If you want to actually do refactoring, read the first four chapters completely. Then skip-read the catalog. Read enough of the catalog to know roughly what is in there. You don't have to understand all the details. When you actually need to carry out a refactoring, read the refactoring in detail and use it to help you. The catalog is a reference section, so you probably won't want to read it in one go. You should also read the guest chapters, especially Chapter 15.
Building on the Foundations Laid by Others
I need to say right now, at the beginning, that I owe a big debt with this book, a debt to those whose work over the last decade has developed the field of refactoring. Ideally one of them should have written this book, but I ended up being the one with the time and energy.
Two of the leading proponents of refactoring are Ward Cunningham and Kent Beck. They used it as a central part of their development process in the early days and have adapted their development processes to take advantage of it. In particular it was my collaboration with Kent that really showed me the importance of refactoring, an inspiration that led directly to this book.
Ralph Johnson leads a group at the University of Illinois at Urbana-Champaign that is notable for its practical contributions to object technology. Ralph has long been a champion of refactoring, and several of his students have worked on the topic. Bill Opdyke developed the first detailed written work on refactoring in his doctoral thesis. John Brant and Don Roberts have gone beyond writing words into writing a tool, the Refactoring Browser, for refactoring Smalltalk programs.
Acknowledgments
Even with all that research to draw on, I still needed a lot of help to write this book. First and foremost, Kent Beck was a huge help. The first seeds were planted in a bar in Detroit when Kent told me about a paper he was writing for the Smalltalk Report Beck, hanoi. It not only provided many ideas for me to steal for Chapter 1 but also started me off in taking notes of refactorings. Kent helped in other places too. He came up with the idea of code smells, encouraged me at various sticky points, and generally worked with me to make this book work. I can't help thinking he could have written this book much better himself, but I had the time and can only hope I did the subject justice.
As I've written this, I wanted to share much of this expertise directly with you, so I'm very grateful that many of these people have spent some time adding some material to this book. Kent Beck, John Brant, William Opdyke, and Don Roberts have all written or co-written chapters. In addition, Rich Garzaniti and Ron Jeffries have added useful sidebars.
Any author will tell you that technical reviewers do a great deal to help in a book like this. As usual, Carter Shanklin and his team at Addison-Wesley put together a great panel of hard-nosed reviewers. These were
Ken Auer, Rolemodel Software, Inc. Joshua Bloch, Javasoft John Brant, University of Illinois at Urbana-Champaign Scott Corley, High Voltage Software, Inc. Ward Cunningham, Cunningham & Cunningham, Inc. Stephane Ducasse Erich Gamma, Object Technology International, Inc. Ron Jeffries Ralph Johnson, University of Illinois Joshua Kerievsky, Industrial Logic, Inc. Doug Lea, SUNY Oswego Sander Tichelaar
They all added a great deal to the readability and accuracy of this book, and removed at least some of the errors that can lurk in any manuscript. I'd like to highlight a couple of very visible suggestions that made a difference to the look of the book. Ward and Ron got me to do Chapter 1 in the side-by-side style. Joshua suggested the idea of the code sketches in the catalog.
In addition to the official review panel there were many unofficial reviewers. These people looked at the manuscript or the work in progress on my Web pages and made helpful comments. They include Leif Bennett, Michael Feathers, Michael Finney, Neil Galarneau, Hisham Ghazouli, Tony Gould, John Isner, Brian Marick, Ralf Reissing, John Salt, Mark Swanson, Dave Thomas, and Don Wells. I'm sure there are others who I've forgotton; I apologize and offer my thanks.
A particularly entertaining review group is the infamous reading group at the University of Illinois at Urbana-Champaign. Because this book reflects so much of their work, I'm particularly grateful for their efforts captured in real audio. This group includes Fredrico "Fred" Balaguer, John Brant, Ian Chai, Brian Foote, Alejandra Garrido, Zhijiang "John" Han, Peter Hatch, Ralph Johnson, Songyu "Raymond" Lu, Dragos-Anton Manolescu, Hiroaki Nakamura, James Overturf, Don Roberts, Chieko Shirai, Les Tyrell, and Joe Yoder.
Any good idea needs to be tested in a serious production system. I saw refactoring have a huge effect on the Chrysler Comprehensive Compensation system (C3). I want to thank all the members of that team: Ann Anderson, Ed Anderi, Ralph Beattie, Kent Beck, David Bryant, Bob Coe, Marie DeArment, Margaret Fronczak, Rich Garzaniti, Dennis Gore, Brian Hacker, Chet Hendrickson, Ron Jeffries, Doug Joppie, David Kim, Paul Kowalsky, Debbie Mueller, Tom Murasky, Richard Nutter, Adrian Pantea, Matt Saigeon, Don Thomas, and Don Wells. Working with them cemented the principles and benefits of refactoring into me on a firsthand basis. Watching their progress as they use refactoring heavily helps me see what refactoring can do when applied to a large project over many years.
Again I had the help of J. Carter Shanklin at Addison-Wesley and his team: Krysia Bebick, Susan Cestone, Chuck Dutton, Kristin Erickson, John Fuller, Christopher Guzikowski, Simone Payment, and Genevieve Rajewski. Working with a good publisher is a pleasure; they provided a lot of support and help.
Talking of support, the biggest sufferer from a book is always the closest to the author, in this case my (now) wife Cindy. Thanks for loving me even when I was hidden in the study. As much time as I put into this book, I never stopped being distracted by thinking of you.
From the Back Cover
As the application of object technology--particularly the Java programming language--has become commonplace, a new problem has emerged to confront the software development community. Significant numbers of poorly designed programs have been created by less-experienced developers, resulting in applications that are inefficient and hard to maintain and extend. Increasingly, software system professionals are discovering just how difficult it is to work with these inherited, "non-optimal" applications. For several years, expert-level object programmers have employed a growing collection of techniques to improve the structural integrity and performance of such existing software programs. Referred to as "refactoring," these practices have remained in the domain of experts because no attempt has been made to transcribe the lore into a form that all developers could use. . .until now. In Refactoring: Improving the Design of Existing Code, renowned object technology mentor Martin Fowler breaks new ground, demystifying these master practices and demonstrating how software practitioners can realize the significant benefits of this new process.
With proper training a skilled system designer can take a bad design and rework it into well-designed, robust code. In this book, Martin Fowler shows you where opportunities for refactoring typically can be found, and how to go about reworking a bad design into a good one. Each refactoring step is simple--seemingly too simple to be worth doing. Refactoring may involve moving a field from one class to another, or pulling some code out of a method to turn it into its own method, or even pushing some code up or down a hierarchy. While these individual steps may seem elementary, the cumulative effect of such small changes can radically improve the design. Refactoring is a proven way to prevent software decay.
In addition to discussing the various techniques of refactoring, the author provides a detailed catalog of more than seventy proven refactorings with helpful pointers that teach you when to apply them; step-by-step instructions for applying each refactoring; and an example illustrating how the refactoring works. The illustrative examples are written in Java, but the ideas are applicable to any object-oriented programming language.
About the Author
Martin Fowler is the Chief Scientist of ThoughtWorks, an enterprise-application development and delivery company. He's been applying object-oriented techniques to enterprise software development for over a decade. He is notorious for his work on patterns, the UML, refactoring, and agile methods. Martin lives in Melrose, Massachusetts, with his wife, Cindy, and a very strange cat. His homepage is http://martinfowler.com.
Kent Beck consistently challenges software engineering dogma, promoting ideas like patterns, test-driven development, and Extreme Programming. Currently affiliated with Three Rivers Institute and Agitar Software, he is the author of many Addison-Wesley titles.
John Brant and Don Roberts are the authors of the Refactoring Browser for Smalltalk, which is found at http://st-www.cs.uiuc.edu/~brant/RefactoringBrowser/. They are also consultants who have studied both the practical and theoretical aspects of refactoring for six years.
William Opdyke's doctoral research on refactoring object-oriented frameworks at the University of Illinois led to the first major publication on this topic. He is currently a Distinguished Member of Technical Staff at Lucent Technologies/Bell Laboratories.
John Brant and Don Roberts are the authors of the Refactoring Browser for Smalltalk, which is found at http://st-www.cs.uiuc.edu/~brant/RefactoringBrowser/. They are also consultants who have studied both the practical and theoretical aspects of refactoring for six years.
Product details
- Publisher : Addison-Wesley Professional; Edition Unstated (January 1, 1999)
- Language : English
- Hardcover : 431 pages
- ISBN-10 : 0201485672
- ISBN-13 : 978-0201485677
- Item Weight : 2.51 pounds
- Dimensions : 1 x 7.5 x 9.25 inches
- Best Sellers Rank: #240,954 in Books (See Top 100 in Books)
- #69 in Object-Oriented Design
- #136 in Computer Programming Languages
- #635 in Computer Software (Books)
- Customer Reviews:
About the authors
Discover more of the author’s books, see similar authors, read book recommendations and more.
For all of my career I've been interested in the design and architecture of software systems, particularly those loosely classed as Enterprise Applications. I firmly believe that poor software design leads to software that is difficult to change in response to growing needs, and encourages buggy software that saps the productivity of computer users everywhere.
I'm always trying to find out what designs are effective, what approaches lead people into trouble, how we can organize our work to do better designs, and how to communicate what I've learned to more people. My books and website are all ways in which I can share what I learn and I'm glad I've found a way to make a living doing this.
Kent Beck is the founder and director of Three Rivers Institute (TRI). His career has combined the practice of software development with reflection, innovation, and communication. His contributions to software development include patterns for software, the rediscovery of test-first programming, the xUnit family of developer testing tools, and Extreme Programming. He currently divides his time between writing, programming, and coaching. Beck is the author/co-author of Implementation Patterns, Extreme Programming Explained: Embrace Change 2nd Edition, Contributing to Eclipse, Test-Driven Development: By Example, Planning Extreme Programming, Smalltalk Best Practice Patterns, and the JUnit Pocket Guide. He received his B.S. and M.S. in Computer Science from the University of Oregon.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Customers find the book's content helpful for improving legacy code and new projects. They find the writing style humorous yet blunt and to the point. The examples are clear, well-thought-out, and relevant. The book is well-structured and provides a common language for discussing refactorings. Overall, customers describe the book as effective and excellent.
AI-generated from the text of customer reviews
Customers find the book's content helpful for improving legacy code and new projects. They appreciate its humorous and engaging presentation of what could have been a dry topic. The hardcover version is considered a great reference.
"Refactoring: Improving the Design of Existing Code is one of those amazing books that every professional developer should have on their book shelf...." Read more
"...need to be congratulated and thanked for their humorous and engaging presentation of what could have been a long dry and dreary list of dos and..." Read more
"...It is a fantastic book. It is one of the books that every software developer in the industry should read...." Read more
"This remarkable book is the next logical step after 'Design Patterns'. In fact, it would be fair to call this 'Re-Design Patterns'...." Read more
Customers find the book useful for developers and software engineering students. It presents concepts clearly with simple examples and UML diagrams. They say it's a practical book for people involved in post-release activities, and a must-read for any serious software engineer. The book helps them understand and make good code changes.
"...You also learn a little bit about testing. After the introductory chapters you begin to dig into a deep catalog of refactorings. Each one is named...." Read more
"...been pleasantly surprised on how entertaining - along with being informative, educative and thorough - this book is...." Read more
"...first impression is that all of it is obvious, but it is explained in an exceptional way and the catalog created by Fowler is really great." Read more
"...For each way of improving a program, it systematically presents a name, set of conditions when it does or does not apply, and (unlike most DP books)..." Read more
Customers find the book easy to use. It outlines simple steps to get to desired code, and the refactoring is performed in small steps. The mechanics provide a step-by-step description of how to carry out the refactoring. The techniques get a program started and refactorings keep it going. They say the examples are very small and simple, so even if you fall into this category, you can still understand them.
"...The mechanics provide a step-by-step description of how to carry out the refactoring and the example shows a small example of the refactoring in use...." Read more
"...The items inside are all very basic and simple...." Read more
"...DP techniques get a program started, refactorings keep it going...." Read more
"The book itself is good as it shows you the small steps of refactoring, and will show you how people came with those ideas a few decades ago...." Read more
Customers appreciate the book's writing style. They find it humorous yet straightforward, with a clear and concise presentation of each concept. The author writes with personality and subtle humor, making it easy to read and well-organized.
"...Martin Fowler books are always a joy to read. His writing style is humorous, yet often very blunt and to the point...." Read more
"The authors need to be congratulated and thanked for their humorous and engaging presentation of what could have been a long dry and dreary list of..." Read more
"...conditions when it does or does not apply, and (unlike most DP books) clear, demonstrative examples and variations...." Read more
"...This book explores how it can be done with humility and subtle humor. I absolutely love it and the effect its had on my programming style." Read more
Customers appreciate the book's design. They find the examples clear and relevant, with a good structure and introduction about the theme. The advice on refactoring and code quality is well-written. Readers say the book helps improve existing code designs. Overall, they describe it as a good product that arrived on time.
"Refactoring: Improving the Design of Existing Code is one of those amazing books that every professional developer should have on their book shelf...." Read more
"...an excellent book of practical advice on refactoring and code quality!..." Read more
"...The examples are clear, well thought out and relevant...." Read more
"helped me improving the design, it's the best refactoring book I have ever read..gives u vague idea about improving the code" Read more
Customers find the book useful for Object-Oriented programming in Java and other languages. It provides a common language for discussing refactorings and helps build programming vocabulary. The examples help you understand techniques and the way of refactoring existing code. The content remains valid even for other languages and for future generations of programmers. Overall, it's a great book for software engineers and developers.
"...As I said earlier, the name is useful because it helps build your programming vocabulary and it helps in communicating thoughts and ideas...." Read more
"...This book will help you look at your existing code and convert it to more object oriented code...." Read more
"...The refactoring catalog is very complete, and useful for software engineers and developers...." Read more
"...Very valuable for teams because it provides a common language to discuss refactorings. The examples are clear, well thought out and relevant...." Read more
Customers find the book useful and effective for improving legacy code. It provides valuable techniques to allow software evolution and improve legacy code.
"...This is very effective...." Read more
"...the software spends most of its life and this book contains valuable techniques to allow the software evolve and fulfill its mission, while avoiding..." Read more
"Excellent resource for improving legacy code." Read more
"Outstanding, a must-read for every software developer." Read more
Customers appreciate the catalog of refactorings. They find it useful and efficient, with clear examples accompanying each refactoring. The concept of patterns is also well-presented.
"...The catalog of refactorings is extremely useful...." Read more
"...but it is explained in an exceptional way and the catalog created by Fowler is really great." Read more
"...book, it uses the concept of patterns and a catalog to efficiently present material...." Read more
"...The refactoring catalog is very complete, and useful for software engineers and developers...." Read more
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on February 16, 2007Refactoring: Improving the Design of Existing Code is one of those amazing books that every professional developer should have on their book shelf. The bulk of this book is a catalog of refactorings, but there is more to it as I will explain below.
In case you aren't aware of what refactoring is, I'll give you Fowlers definition.
"Refactoring 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." For the most part this means cleaning up your existing - yet working - code. It involves anything from renaming a method to be more concise with the purpose of that method, to breaking up switch statements into a polymorphic structure. There are many different techniques used to refactor your code, which is what you learn in this book.
Right off the bat Fowler throws you into a small sample application that is poorly designed. He then takes you through a few different refactoring techniques that improve the design of this simple application. Right from the start you see how effective refactoring can be. From there he goes into topics such as how to detect "bad smells" in code. This chapter is particularly informative and entertaining. You also learn a little bit about testing. After the introductory chapters you begin to dig into a deep catalog of refactorings. Each one is named. Like design patterns - naming the refactoring and building a vocabulary really helps in communicating thoughts and ideas.
The catalog of refactorings is extremely useful. They are structured so that each refactoring has a name, a motivation, the mechanics and a simple example. This is very effective. As I said earlier, the name is useful because it helps build your programming vocabulary and it helps in communicating thoughts and ideas. The motivation explains why the refactoring should be done and when it should/shouldn't be used. The mechanics provide a step-by-step description of how to carry out the refactoring and the example shows a small example of the refactoring in use. All examples are written in Java 1.1.
Although the examples are written in Java the book is still very good for any developer. Developers that have never written a line of code in Java, C++, C#, or anything similar may have a little bit of a tougher time working through this book. Luckily most examples are very small and simple so even if you fall into this category you shouldn't have too much of a learning curve. Some of the code is a bit outdated and can be done a bit better now-a-days but what do you expect? This book was written 8+ years ago! Times have changed. The ideas are still very relevant though, which is what makes this book so timeless.
Martin Fowler books are always a joy to read. His writing style is humorous, yet often very blunt and to the point. Just like UML Distilled, he is able to communicate a lot of ideas into a very short amount of space - the book is a bit dense in other words, which is very good in my opinion. Martin Fowler does not beat around the bush and he has very strong opinions on certain topics. Unlike a lot of books you read, he actually writes with personality. I have a hard time putting his books down. Here is an example of the type of verbiage he uses...
On how comments can be a "bad smell":
"Don't worry; we aren't saying that people shouldn't write comments. In our olfactory analogy, comments aren't a bad smell; indeed they are a sweet smell. The reason we mention comments here is that comments often are used as a deodorant." - Martin Fowler. Here he is talking about how people use comments to hide bad code, or "bad smells".
I highly recommend this book. If you are a professional developer or plan on becoming one then click the "Buy Now" button without second thought. This is one of those rare books worth its weight in gold - I would spend $100.00 on a book like this if I had to.
- Reviewed in the United States on June 16, 2016The authors need to be congratulated and thanked for their humorous and engaging presentation of what could have been a long dry and dreary list of dos and don'ts.
I just started reading this book and I was wondering if it is going to be too dry and difficult to read. Instead, I have been pleasantly surprised on how entertaining - along with being informative, educative and thorough - this book is.There are several interesting anecdotes - the narration of which is aimed at underscoring what is important and where we should focus our efforts on. The lead author engages in quite a bit of self deprecating humor while narrating these stories - while clearly having written this book - he is an authority on the topic and all the techniques being described. The point of the humor - as I understand is to help us adopt good practices and good coding habits.
In addition to these anecdotes, the book is littered with witty and funny prose in order to drive home important points. Here is a sample from the text where the authors tell us why they included "Comments" as one of the code smells:
"Don’t worry, we aren’t saying that people shouldn’t write comments. In our olfactory analogy, comments aren’t a bad smell; indeed they are a sweet smell. The reason we mention comments here is that comments often are used as a deodorant."
I can't remember having seen humor being applied so effectively in a text/reference book of this stature to make a point. And the point being made here is that comments often tend to describe code which is hard to understand and good code should be self descriptive and hence comments should not really be needed if the code was indeed self-descriptive. I am happy that such a writing style makes it hard for me to put the book down and to continue reading!
- Reviewed in the United States on December 12, 2013This book is a bit old. It is the first, or among the first, which addresses the refactoring issue. However, everything in it is relevant today.
At the beginning and at the end you will find articles by various authors (Fowler, Beck, Opdyke, Roberts and Brant):
* Refactoring , first example.
* Principles of refactoring .
* Bad smells in code .
* Building Tests.
* Toward a Catalog of Refactorings .
* Big Refactorings .
* Refactoring , Reuse , and Reality .
* Refactoring Tools.
* Putting It All Together.
In the middle will find a great catalog of small transformations that define the steps to do the refactoring. This catalog, though simple is very important as explained in the first chapters.
Fowler clearly explains why refactoring, some clues to identify the most important issues (code smells) to refactor in order to improves the design, and the catalog of transformations that are commonly used to solve each code smells.
Dependending your experience and knowledge of software craftsmanship, you will surely perceive it more or less as a simple topic, but that makes it no less important.
It is a fantastic book. It is one of the books that every software developer in the industry should read. The only reason I'm not giving 5 stars is that it is not a truly revealing book. The items inside are all very basic and simple. You should not expect anything astonishing and the first impression is that all of it is obvious, but it is explained in an exceptional way and the catalog created by Fowler is really great.
Top reviews from other countries
- Lia GhitaReviewed in Germany on November 25, 2021
5.0 out of 5 stars Good quality. Extremely fast delivery
The book is in very good condition. The delivery was extremely fast and via courier.
-
Bruno Santos de LimaReviewed in Brazil on September 4, 2018
5.0 out of 5 stars Muito bom!
Livro muito bom, indico para qualquer desenvolvedor ou pesquisador que trabalhe com refatoração.
- TREXReviewed in the United Kingdom on December 22, 2019
5.0 out of 5 stars Very Readable And Highly Insightful
I should have read this a few years ago. Ideally just after I'd first learned Java.
Till I read this I'd always refactored on the basis of performance, reflecting a prior career in hard engineering. So if I used a block of code more than once then I extracted that block as a method. Or if I used a computed value more than once in a code unit then I used a temp variable to store that value and save repeated computation. Otherwise I usually left the code as it was.
After reading the very lucid (and honestly written) first 3 chapters I will never be so simplistic again. Fowler advises refactoring even if only to improve readability of the code. But refactoring ought to also be done with object-oriented design advantages in mind, e.g. maintainability and extendability. So long lists of class attributes or method parameters are discouraged in favour of grouping in an array or agglomerates; interface differentiation preferred to sibling class creation and so on.
Fowler explains how refactoring itself does not address performance issues - in fact the refactoring process may reduce performance a bit. Neither will refactoring eliminate performance drag due to bad system architecture: system design always remains the primary way to achieve performance. But refactoring does prepare code for final optimisation in that it breaks it into its sort of natural components which can then be analysed individually. Performance issues, like so many other effects, follow a Pareto distribution: 80-90% of the drag is attributable to 10-20% of the code components. So refactoring provides a means of getting the maximum gain in system speed with the minimum of code or algorithm changes - as well as the primary benefit of readable and reusable code.
The organisation of this book is itself commendable. After easily read intro chapters, he has catalogued all minor refactorings in several subsequent chapters using UML diagrams as well as explanations. Major refactorings are presented after this. Then some actual case studies with commercial systems are covered, software tools for refactoring are discussed and a final summing-up chapter with last tips. Inside the front cover we have a convenient index of the refactorings. And inside the back cover we have an index of code smells (code items that just seem intuitively obtuse) opposite their recommended refactoring.
Many previous reviewers of this book said this stuff is already in Gang Of Four or Josh Bloch's Effective Java. Some even opine that the book is puffed out and could use some refactoring itself. This is the just the kind of response you get from dumb people after they see a solution presented to them: it sublimely ignores the fact that those same people didn't even recognise the original problem - let alone its solution. I take my hat off to Fowler for this work. Despite its age and the primitive Java version used, the essence of this work still holds true nearly 20 years on. That alone makes it a software classic.
- Kamran BigdelyReviewed in Canada on May 15, 2017
5.0 out of 5 stars The language of this book is funny and I loved the way author(s) talks with the ...
Some people say this book is not relevant anymore. To me, its obvious that it's completely relevant as of 2017. This book changed my attitude toward programming. I used to spend lots of time to design the software architecture and was too obsessed with my coding style. This approach caused me to become very unproductive and slow. Then I started reading this book and was noticed that my approach was wrong (read it to see why it is wrong to be obsessed with planning your software architecture before writing code). This book answers many of questions that I had but couldn't find the answers even on stackoverflow. The language of this book is funny and I loved the way author(s) talks with the reader. I highly recommend it especially for intermediate and advanced programmers.
-
XavierReviewed in Spain on November 24, 2017
5.0 out of 5 stars Muy buen libro
Todo buen programador que se precie, tiene que leerse este libro.
Se lee bien, y con bastantes ejemplos que lo hacen más fácil y más agradable de leer.