Live data from Hacker News

Announcing the Second Edition of “Refactoring”

martinfowler.com

11–20 of 61 posts

Re: Announcing the Second Edition of “Refactoring”

#11

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

I found it very interesting for being one of the very few books that deals with code as a formal system.

You don't need to understand the code; you don't need to step through the code. You follow the steps for "extract method" and you go from a working state to another working state with no worries.

The individual refactorings are more-or-less interesting, but as others have said, they're somewhat commonplace now.

Two books that every programmer should read: Software Tools[1] and The Elements of Programming Style[2] by Kernighan and Plauger. Bonus: The Unix Programming Environment[3] by Kernighan and Pike.

[1] https://www.amazon.com/Software-Tools-Pascal-Brian-Kernighan...

[2] https://www.amazon.com/Elements-Programming-Style-2nd/dp/007...

[3] https://www.amazon.com/Unix-Programming-Environment-Prentice...

Re: Announcing the Second Edition of “Refactoring”

#12

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

The first edition suffers from being a victim of its own success. Much of it has become common wisdom and many of the refactoring techniques now have IDE support.

"Working Effectively with Legacy Code"^1 is usually what I recommend instead. It felt like a more up to date approach

More generally "The Pragmatic Programmer"^2 is a classic for a reason. But from you're comment you've probably already read it.

1. https://amzn.to/2I4rIWP 2. https://amzn.to/2GfxVTa

2.

Re: Announcing the Second Edition of “Refactoring”

#13
post #11

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

I found it very interesting for being one of the very few books that deals with code as a formal system. You don't need to understand the code; you don't need to step through the code. You follow the steps for "extract method" and you go from a working state to another working state with no worries. The individual refactorings are more-or-less interesting, but as others have said, they're somewhat commonplace now. Tw…

Would you recommend "Software Tools in Pascal" vs the original?

Re: Announcing the Second Edition of “Refactoring”

#14

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

I enjoyed the first edition immensely. Some folks are calling out that most of the refactorings are mainstream, but IDE integration doesn’t mean that it has become common practice or second nature to most engineers.

If I was going to read a refactoring book while waiting for the second edition, I would take a look at “Refactoring to patterns.” (https://industriallogic.com/xp/refactoring/) R2P combines the best parts of Fowler’s Refactoring and the Gang of Four design pattern book.

Notably: it emphasizes the fluid nature of Refactoring and design patterns. Every Refactoring to a pattern in the book is shown in a few different ways, each explaining some of the trade offs. It has the same recipe book feel that Fowler’s book has and it lends itself to browsing and reference.

The recipe-driven approach makes it easy to carry out the refactorings and provides a fun new way to think about modifying code.

Imho, the section on the “Compose method” Refactoring in R2P makes the purchase worth it. How can such a dead simple Refactoring make code so much nicer? Read the book to find out ;)

Re: Announcing the Second Edition of “Refactoring”

#15

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

I read it 15 years ago. No other book has influenced my programming as much as this one. The main value I got from it is that it teaches you what "clean" code looks like. Highly recommended.

You might also enjoy "Beautiful Code" then. While not everyone will agree that every example in that book is "beautiful", usually there's something in there for everyone. It's currently my favorite generalized programming book.

Re: Announcing the Second Edition of “Refactoring”

#18

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

It is a must-read for anyone who programs systems bigger than a student class project.

Re: Announcing the Second Edition of “Refactoring”

#19
post #8

I'm hunting around these days for good books on general programming. I'm a fairly pragmatic programmer (not everything needs to be a class). Has anybody here read the first edition, and what was your impression of it?

One of my biggest lessons from the book is right in the introduction. To paraphrase: "If a change you want to make to the codebase is hard, refactor the codebase until that change is easy, then make the change". I always try to either be refactoring or changing behavior but not both at the same time. That has kept me out of a lot of trouble.

A rule of thumb that I try to follow (but often neglect) is to keep changes either sweeping/shallow or narrow/deep. So if you're refactoring a module and that has implications across the codebase, don't try to make a deep change to the business logic at the same time.

Keep those tasks separate.

Re: Announcing the Second Edition of “Refactoring”

#20
The Refactoring book in Javascript looks like an early April, 1st joke :-)

What I really miss is the integration with the automatic refactoring tools in our IDEs. How would I make a heavy refactoring if I already have a "extract method" in my interface? Would it be the same? Some of the refactorings are easier to automate so are more common in the IDEs. Would are better paths considering what is automated?

Post reply on HN