Watch the new season of Amazon Original series The Wheel of Time now on Prime Video. New episode weekly.
$51.55 with 22 percent savings
List Price: $65.99
FREE Returns
FREE delivery Tuesday, March 18
Or Prime members get FREE delivery Tomorrow, March 14. Order within 8 hrs 30 mins.
In Stock
$$51.55 () Includes selected options. Includes initial monthly payment and selected options. Details
Price
Subtotal
$$51.55
Subtotal
Initial payment breakdown
Shipping cost, delivery date, and order total (including tax) shown at checkout.
Ships from
Amazon.com
Amazon.com
Ships from
Amazon.com
Sold by
Amazon.com
Amazon.com
Sold by
Amazon.com
Returns
30-day refund/replacement
30-day refund/replacement
This item can be returned in its original condition for a full refund or replacement within 30 days of receipt.
Payment
Secure transaction
Your transaction is secure
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
Kindle app logo image

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.

QR code to download the Kindle App

Follow the author

Something went wrong. Please try your request again later.

Refactoring: Improving the Design of Existing Code (2nd Edition) (Addison-Wesley Signature Series (Fowler)) 2nd Edition

4.7 4.7 out of 5 stars 1,124 ratings

{"desktop_buybox_group_1":[{"displayPrice":"$51.55","priceAmount":51.55,"currencySymbol":"$","integerValue":"51","decimalSeparator":".","fractionalValue":"55","symbolPosition":"left","hasSpace":false,"showFractionalPartIfEmpty":true,"offerListingId":"%2BdTxi1NRuDPN4HksnMLOistRegMqjCzt27IUt%2Bms3YPEugqnNzl26Cernt04xLcKeuVc4hijGce%2Fyowt%2FLHU4JXvr0b4z5%2BdGcWEXxrN2eS2bbRy52DrM2Ma%2BVlwT70%2B9v0POWuONmP6hdYDR%2Be6Kg%3D%3D","locale":"en-US","buyingOptionType":"NEW","aapiBuyingOptionIndex":0}]}

Purchase options and add-ons

"Whenever you read [Refactoring], it’s time to read it again. And if you haven’t read it yet, please do before writing another line of code." –David Heinemeier Hansson, Creator of Ruby on Rails, Founder & CTO at Basecamp


Fully Revised and Updated—Includes New Refactoring's and Code Examples

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
–M. Fowler (1999)

For more than twenty years, experienced programmers worldwide have relied on Martin Fowler’s Refactoring to improve the design of existing code and to enhance software maintainability, as well as to make existing code easier to understand.


This eagerly awaited new edition has been fully updated to reflect crucial changes in the programming landscape. Refactoring, Second Edition, features an updated catalog of refactoring's and includes JavaScript code examples, as well as new functional examples that demonstrate refactoring without classes.


Like the original, this edition explains what refactoring is; why you should refactor; how to recognize code that needs refactoring; and how to actually do it successfully, no matter what language you use.

  • Understand the process and general principles of refactoring
  • Quickly apply useful refactorings to make a program easier to comprehend and change
  • Recognize “bad smells” in code that signal opportunities to refactor
  • Explore the refactorings, each with explanations, motivation, mechanics, and simple examples
  • Build solid tests for your refactorings
  • Recognize tradeoffs and obstacles to refactoring

Includes free access to the canonical web edition, with even more refactoring resources. (See inside the book for details about how to access the web edition.)

Frequently bought together

This item: Refactoring: Improving the Design of Existing Code (2nd Edition) (Addison-Wesley Signature Series (Fowler))
$51.55
Get it as soon as Tuesday, Mar 18
In Stock
Ships from and sold by Amazon.com.
+
$33.06
Get it as soon as Tuesday, Mar 18
In Stock
Ships from and sold by Amazon.com.
+
$23.65
Get it as soon as Tuesday, Mar 18
In Stock
Ships from and sold by Amazon.com.
Total price: $00
To see our price, add these items to your cart.
Details
Added to Cart
spCSRF_Treatment
Choose items to buy together.

From the Publisher

Woman Coding at 2 monitors

Refactoring is...

a disciplined way to clean up code that minimizes the chances of introducing bugs. Although it is focused on the code, refactoring has a large impact on the design of systems. It is vital for senior designers and architects, as well as professional programmers, to understand the principles of refactoring and to use them in their projects.

Editorial Reviews

Review

Select Guide Rating

About the Author

Martin Fowler is Chief Scientist at ThoughtWorks. He describes himself as “an author, speaker, consultant and general loud-mouth on software development.” Fowler concentrates on designing enterprise software: exploring what makes a good design and what practices are needed to create one.

Product details

  • Publisher ‏ : ‎ Addison-Wesley Professional; 2nd edition (November 30, 2018)
  • Language ‏ : ‎ English
  • Hardcover ‏ : ‎ 448 pages
  • ISBN-10 ‏ : ‎ 0134757599
  • ISBN-13 ‏ : ‎ 978-0134757599
  • Item Weight ‏ : ‎ 1.6 pounds
  • Dimensions ‏ : ‎ 0.8 x 7.4 x 9.2 inches
  • Customer Reviews:
    4.7 4.7 out of 5 stars 1,124 ratings

About the author

Follow authors to get new release updates, plus improved recommendations.
Martin Fowler
Brief content visible, double tap to read full content.
Full content visible, double tap to read brief content.

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.

Customer reviews

4.7 out of 5 stars
1,124 global ratings

Review this product

Share your thoughts with other customers

Customers say

Customers find the book's examples and concepts informative and helpful for refactoring. They describe it as a useful reference with great examples of following clean code guidelines. The book is well-written, concise, and easy to understand.

AI-generated from the text of customer reviews

Select to learn more

23 customers mention "Knowledge level"23 positive0 negative

Customers find the book's examples and concepts informative. They find it a useful reference for refactoring, with great examples of following clean code guidelines. The content is helpful for identifying refactoring opportunities and the techniques to implement. Readers appreciate the depth of knowledge and technical precision of the author. Overall, they describe it as the best book on the topic, even for experienced programmers.

"...Other than that this book has taught me so much about refactoring and will be a go to book for the rest of my software development career." Read more

"Very solid pattern-oriented book. Must have for every software engineer." Read more

"...The present one shows JavaScript ones. The examples are real-life but simple enough to not distract from the core - how to simplify the "first..." Read more

"This is a comprehensive review of refactoring." Read more

14 customers mention "Readability"10 positive4 negative

Customers find the book easy to read and understand. They appreciate the concise writing style and clear explanations. The examples are practical but simple enough to focus on the core concepts. Readers also mention that the book is pattern-oriented and contains many diagrams.

"...Also, the book quality is high and there are lots of pretty diagrams if it matters for you (it certainly does for me)." Read more

"Very solid pattern-oriented book. Must have for every software engineer." Read more

"...This book is not a quick read but should be read in its entirety to really take in all that refactoring has to offer...." Read more

"...It has been a huge time saving and long-term benefit for collaborative work and fits very well within the philosophy of "continuous..." Read more

If you have the right 'why', you can bear almost any 'how'
4 out of 5 stars
If you have the right 'why', you can bear almost any 'how'
Code is written by humans, executed by machines. Live code is also read by (other) humans for about 10x more than the time it took to write it. This is where "refactoring" comes to play. It is sort of making continuous improvement to code so it is more readable. It is cleaning up cobwebs from the corners.One of the most popular CS papers ever ("Hints for Computer System Design", 1983) suggests 3-step process about writing code - first, make it work; second, make it right; finally, make it fast". This book, a succinct second edition of a very popular first, is an excellent "show and tell" for the second part.It has a catalog of "code smells" and an inventory of "refactoring tricks" mapped to each. The first edition had working Java examples. The present one shows JavaScript ones. The examples are real-life but simple enough to not distract from the core - how to simplify the "first version" of code. Apart from the content, the insights that pops out can only be gleaned from years of deep experience. One example, say, most developers encode a "phone number" attribute as string in the first attempt of modeling. Soon enough, one needs to add "spam rules", "blocking number", "area code" etc. That necessitates phone number to be 'refactored' from string (i.e., a primitive type) to its own object model (say, a class called PhoneNumber). The author cheekily refers to the former type of behavior as "stringly typed" variables. Word play is a hallmark of many good engineers I'd worked with, but it is also a phenomenal way to remember things. Humor shortens the retrieval curve.What I liked most about the book is a broad adoption of "Paracelsus' Maxim" - the difference between a poison and something benign is the dose. Most of the refactoring pattens come in pairs. You can "extract function" from a big one, or "inline function code" if it is short, obvious and singularly used, say. You can "replace parameter with query" or "replace query with a parameter". The only unpaired pattern shows up with large/complex conditionals (say, a switch, or a multiway nested conditional with 'guard clause) - most/all of them are pain to read and should ideally be refactored, say, with "replace conditional with polymorphism". Live book site has 4 more patterns beyond the book.I found the refactoring patterns could be of three principal dimensions - one, structure -- variable, method, class, conditional; two, usage and locality -- depending on how much they're used and if they are used within/outside the module (class); three, data and mutation -- there is a clear separation between refactoring a data (or, value) object/data passed as value- or reference; separating data (query) from command etc. On top of that, some of the refactoring could be thought of as "helping the original developer" (say, to modularize or DRY better) vs. "helping others who may read the code later".When I read the first edition years ago, IDEs were not as robust nor opinionated enough about refactoring. These days, majority if not all the refactoring is done by default - one just needs to click to accept, say, extracting a method. It has been a huge time saving and long-term benefit for collaborative work and fits very well within the philosophy of "continuous integration"/Kaizen etc. One could argue that lowers the importance of such book. While the IDE may do the grunt work, key decisioning remains with humans, for now. Especially since most refactoring could appear in polar opposites it is therefore even more important to understand the context - the "why" - which this book brilliantly lays out.
Thank you for your feedback
Sorry, there was an error
Sorry we couldn't load the review

Top reviews from the United States

  • Reviewed in the United States on October 6, 2024
    This is a great book!

    I'm a Java dev with 6yoe and I still learn from this book. There are some things I knew, some I forgotten or thought about but didn't know a proper name of and some I have never thought of. The language used is Javascript but it's syntax shouldn't be hard to follow.

    Also, the book quality is high and there are lots of pretty diagrams if it matters for you (it certainly does for me).
  • Reviewed in the United States on January 3, 2023
    Fantastic book and one that should be in every developers personal library. The depth of knowledge and technical precision the author has in regards to refactoring is immense. This book is not a quick read but should be read in its entirety to really take in all that refactoring has to offer. Refactoring has now become part of my everyday programming and development process.

    There is only one thing I would change about the book and that is for the author to add the completed refactored code for some of the more complex methodologies to the end of each refactoring. Some of the refactoring methodologies can be quite extensive and by adding the completed refactored code to the end may help give a clearer picture of the information the author is imparting to the reader. Other than that this book has taught me so much about refactoring and will be a go to book for the rest of my software development career.
    8 people found this helpful
    Report
  • Reviewed in the United States on July 7, 2024
    Very solid pattern-oriented book. Must have for every software engineer.
  • Reviewed in the United States on October 27, 2023
    Code is written by humans, executed by machines. Live code is also read by (other) humans for about 10x more than the time it took to write it. This is where "refactoring" comes to play. It is sort of making continuous improvement to code so it is more readable. It is cleaning up cobwebs from the corners.

    One of the most popular CS papers ever ("Hints for Computer System Design", 1983) suggests 3-step process about writing code - first, make it work; second, make it right; finally, make it fast". This book, a succinct second edition of a very popular first, is an excellent "show and tell" for the second part.

    It has a catalog of "code smells" and an inventory of "refactoring tricks" mapped to each. The first edition had working Java examples. The present one shows JavaScript ones. The examples are real-life but simple enough to not distract from the core - how to simplify the "first version" of code. Apart from the content, the insights that pops out can only be gleaned from years of deep experience. One example, say, most developers encode a "phone number" attribute as string in the first attempt of modeling. Soon enough, one needs to add "spam rules", "blocking number", "area code" etc. That necessitates phone number to be 'refactored' from string (i.e., a primitive type) to its own object model (say, a class called PhoneNumber). The author cheekily refers to the former type of behavior as "stringly typed" variables. Word play is a hallmark of many good engineers I'd worked with, but it is also a phenomenal way to remember things. Humor shortens the retrieval curve.

    What I liked most about the book is a broad adoption of "Paracelsus' Maxim" - the difference between a poison and something benign is the dose. Most of the refactoring pattens come in pairs. You can "extract function" from a big one, or "inline function code" if it is short, obvious and singularly used, say. You can "replace parameter with query" or "replace query with a parameter". The only unpaired pattern shows up with large/complex conditionals (say, a switch, or a multiway nested conditional with 'guard clause) - most/all of them are pain to read and should ideally be refactored, say, with "replace conditional with polymorphism". Live book site has 4 more patterns beyond the book.

    I found the refactoring patterns could be of three principal dimensions - one, structure -- variable, method, class, conditional; two, usage and locality -- depending on how much they're used and if they are used within/outside the module (class); three, data and mutation -- there is a clear separation between refactoring a data (or, value) object/data passed as value- or reference; separating data (query) from command etc. On top of that, some of the refactoring could be thought of as "helping the original developer" (say, to modularize or DRY better) vs. "helping others who may read the code later".

    When I read the first edition years ago, IDEs were not as robust nor opinionated enough about refactoring. These days, majority if not all the refactoring is done by default - one just needs to click to accept, say, extracting a method. It has been a huge time saving and long-term benefit for collaborative work and fits very well within the philosophy of "continuous integration"/Kaizen etc. One could argue that lowers the importance of such book. While the IDE may do the grunt work, key decisioning remains with humans, for now. Especially since most refactoring could appear in polar opposites it is therefore even more important to understand the context - the "why" - which this book brilliantly lays out.
    Customer image
    4.0 out of 5 stars
    If you have the right 'why', you can bear almost any 'how'

    Reviewed in the United States on October 27, 2023
    Code is written by humans, executed by machines. Live code is also read by (other) humans for about 10x more than the time it took to write it. This is where "refactoring" comes to play. It is sort of making continuous improvement to code so it is more readable. It is cleaning up cobwebs from the corners.

    One of the most popular CS papers ever ("Hints for Computer System Design", 1983) suggests 3-step process about writing code - first, make it work; second, make it right; finally, make it fast". This book, a succinct second edition of a very popular first, is an excellent "show and tell" for the second part.

    It has a catalog of "code smells" and an inventory of "refactoring tricks" mapped to each. The first edition had working Java examples. The present one shows JavaScript ones. The examples are real-life but simple enough to not distract from the core - how to simplify the "first version" of code. Apart from the content, the insights that pops out can only be gleaned from years of deep experience. One example, say, most developers encode a "phone number" attribute as string in the first attempt of modeling. Soon enough, one needs to add "spam rules", "blocking number", "area code" etc. That necessitates phone number to be 'refactored' from string (i.e., a primitive type) to its own object model (say, a class called PhoneNumber). The author cheekily refers to the former type of behavior as "stringly typed" variables. Word play is a hallmark of many good engineers I'd worked with, but it is also a phenomenal way to remember things. Humor shortens the retrieval curve.

    What I liked most about the book is a broad adoption of "Paracelsus' Maxim" - the difference between a poison and something benign is the dose. Most of the refactoring pattens come in pairs. You can "extract function" from a big one, or "inline function code" if it is short, obvious and singularly used, say. You can "replace parameter with query" or "replace query with a parameter". The only unpaired pattern shows up with large/complex conditionals (say, a switch, or a multiway nested conditional with 'guard clause) - most/all of them are pain to read and should ideally be refactored, say, with "replace conditional with polymorphism". Live book site has 4 more patterns beyond the book.

    I found the refactoring patterns could be of three principal dimensions - one, structure -- variable, method, class, conditional; two, usage and locality -- depending on how much they're used and if they are used within/outside the module (class); three, data and mutation -- there is a clear separation between refactoring a data (or, value) object/data passed as value- or reference; separating data (query) from command etc. On top of that, some of the refactoring could be thought of as "helping the original developer" (say, to modularize or DRY better) vs. "helping others who may read the code later".

    When I read the first edition years ago, IDEs were not as robust nor opinionated enough about refactoring. These days, majority if not all the refactoring is done by default - one just needs to click to accept, say, extracting a method. It has been a huge time saving and long-term benefit for collaborative work and fits very well within the philosophy of "continuous integration"/Kaizen etc. One could argue that lowers the importance of such book. While the IDE may do the grunt work, key decisioning remains with humans, for now. Especially since most refactoring could appear in polar opposites it is therefore even more important to understand the context - the "why" - which this book brilliantly lays out.
    Images in this review
    Customer imageCustomer image
    3 people found this helpful
    Report
  • Reviewed in the United States on August 18, 2024
    This is a comprehensive review of refactoring.
  • Reviewed in the United States on September 17, 2023
    One of the best software developer books, If you have the challenge of redesign a software application this is the book you need to read but before buy it, make sure the application you are going to refactor has unit-tests, if not as the book mentioned first you need to read: Working Effectively with Legacy Code of Michael Feathers, read this book first and later read this one.
    Thank you so much to Martin Fowler.
    6 people found this helpful
    Report
  • Reviewed in the United States on March 9, 2024
    Best book related to this topic, examples are easy to understand.

    Book arrived in perfect conditions to Bolivia.
    One person found this helpful
    Report
  • Reviewed in the United States on August 16, 2022
    This book is a quick read but is unusually clear and practical. I recommend it to everyone on my team and have see it change the way people program for the better.
    3 people found this helpful
    Report

Top reviews from other countries

Translate all reviews to English
  • wataru oguchi
    5.0 out of 5 stars Read this right now. It will change your behaviour.
    Reviewed in Canada on December 16, 2023
    I have been in the software development industry for more than 10 years. I met this book 5 years ago, and instantly thought I wish I had this book earlier in my career. Oh well, you can't turn back the clock.
    Since then, I have kept recommending this book in my community. I even bought some copies for young developers to help their growth.
  • Rafael
    5.0 out of 5 stars Excelente libro
    Reviewed in Mexico on January 26, 2023
    Muy buen libro, desde las primeras páginas me dio tips para realizar refactor en mis proyectos.
    Report
  • Marina Sobotzik
    5.0 out of 5 stars Sehr gutes Buch
    Reviewed in Germany on February 18, 2025
    Refactoring gut verständlich und mit Beispielen
  • Francisco Giraldo
    3.0 out of 5 stars Cover is hard but the pages are very thin
    Reviewed in the Netherlands on December 30, 2024
    The hard cover is good but the pages are so thin like a bible. They feel they can be damaged very easily.
  • Luca
    5.0 out of 5 stars Un must per ogni programmatore
    Reviewed in Italy on September 10, 2024
    è un libro essenziale per chiunque sia coinvolto nello sviluppo del software. Mi è piaciuto particolarmente il modo in cui il libro affronta il refactoring in maniera sistematica, offrendo tecniche concrete per migliorare la qualità del codice esistente senza alterarne la funzionalità.

    Il libro è ricco di esempi pratici che rendono chiari i concetti anche per chi non ha una grande esperienza in materia. Inoltre, le annotazioni di Kent Beck aggiungono ulteriore valore, fornendo una prospettiva aggiuntiva sui metodi agili. Ho usato questo libro principalmente per migliorare il design del codice in progetti legacy, e devo dire che ha cambiato il mio approccio al refactoring.

    In sintesi, è un libro che ogni sviluppatore dovrebbe avere nella propria libreria, non solo per apprendere nuove tecniche
    Customer image
    Luca
    5.0 out of 5 stars
    Un must per ogni programmatore

    Reviewed in Italy on September 10, 2024
    è un libro essenziale per chiunque sia coinvolto nello sviluppo del software. Mi è piaciuto particolarmente il modo in cui il libro affronta il refactoring in maniera sistematica, offrendo tecniche concrete per migliorare la qualità del codice esistente senza alterarne la funzionalità.

    Il libro è ricco di esempi pratici che rendono chiari i concetti anche per chi non ha una grande esperienza in materia. Inoltre, le annotazioni di Kent Beck aggiungono ulteriore valore, fornendo una prospettiva aggiuntiva sui metodi agili. Ho usato questo libro principalmente per migliorare il design del codice in progetti legacy, e devo dire che ha cambiato il mio approccio al refactoring.

    In sintesi, è un libro che ogni sviluppatore dovrebbe avere nella propria libreria, non solo per apprendere nuove tecniche
    Images in this review
    Customer image