Live data from Hacker News

Announcing the Second Edition of “Refactoring”

martinfowler.com

41–50 of 61 posts

Re: Announcing the Second Edition of “Refactoring”

#41
Am looking forward to the book. Read the first one in the early mid 2000s and it changed my view of programming forever. Java in the modern climate isn't the best choice anymore to do this.

The move to a less class-centric approach is a much needed and welcomed shift. It helps to illustrate the spirit of the pattern or technique without getting weighed down with the restrictiveness and arguably dogmatic nature of java.

Re: Announcing the Second Edition of “Refactoring”

#42
This is intriguing, though personally I never connected much with Fowler's writing in the past (though I have gotten into his ideas).

Anyone know of any other good books about high-level design/architecture for javascript?

Actually, thinking about it, maybe what I'm really looking for is something for designing/architecting things in dynamic/weakly typed languages... (Been doing JS for a bit now, but I spent much longer in Java before).

Re: Announcing the Second Edition of “Refactoring”

#43
post #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?

I'm asking this from a position of massive ignorance (I'm mostly a backend dev who does the occasional website), but is there any type hinting tooling in the Javascript ecosystem? Python has PEP484 where you annotate types in either comments or docstrings, Ruby has YARD tags used similarly, and smart IDEs can pick up on these and offer decent refactoring tools. But does anything similar exist in JS land?

Yes, there is JSDoc[1] which allows you to add type annotations in comments, that can then be used by some tool.

The VSCode editor is able to leverage the TypeScript engine even with vanilla JS to automatically infer types and also supports JSDoc. Basically you write vanilla JS, add JSDoc comments here and there when the inference doesn't work as you want and it gives you most benefits of a typed language, without tying yourself to a specific ecosystem (your teammates could be using something else entirely). It works pretty well.

[1] http://usejsdoc.org/

Re: Announcing the Second Edition of “Refactoring”

#44
post #28
post #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?

Seems like JavaScript would make sense since there are so many young, inexperienced js developers that stand to potentially benefit from such a book.

Probably it makes sense because it is the most used lang in the world. Everybody has a interpreter on their computers. Also there are more people to buy the book.

Re: Announcing the Second Edition of “Refactoring”

#45
I realise this is an unpopular opinion, but I really didn't like the previous book. Don't get me wrong, I definitely think refactoring is a good thing (in moderation!). But Fowler presented a list of possible refactoring operations, including step by step instructions... for very trivial things.

In the introduction he drew comparisons with GoF design patterns book, saying he wrote it hoping people would refer back to it as they do to that book. Yes, sometimes I need to rename a function or split it in two, but do I really need to dig out a reference book to look up how to do that? And the comparison to design patterns is crazy, those are at a far higher level of abstraction and are correspondingly less obvious (and more interesting).

Re: Announcing the Second Edition of “Refactoring”

#46

I realise this is an unpopular opinion, but I really didn't like the previous book. Don't get me wrong, I definitely think refactoring is a good thing (in moderation!). But Fowler presented a list of possible refactoring operations, including step by step instructions... for very trivial things. In the introduction he drew comparisons with GoF design patterns book, saying he wrote it hoping people would refer back to…

I never read more than a fraction of the first edition, but I found it valuable. The key idea was that refactoring was a methodical, careful process that consists of steadily taking the code from one working state to another. At the time, refactoring was a dirty word at my company, and people didn’t distinguish it from rewriting code in any arbitrary fashion.

Re: Announcing the Second Edition of “Refactoring”

#47

I realise this is an unpopular opinion, but I really didn't like the previous book. Don't get me wrong, I definitely think refactoring is a good thing (in moderation!). But Fowler presented a list of possible refactoring operations, including step by step instructions... for very trivial things. In the introduction he drew comparisons with GoF design patterns book, saying he wrote it hoping people would refer back to…

I've found out that in my decades of software engineering that what I take as trivial and simple actually isn't for folks who haven't really delved into it or they are mid or junior level engineers.

I'd rather do skim reading on stuff that I already know than for them to skip over it just in case there was a fundamental issue that was missed (or deemed trivial).

Re: Announcing the Second Edition of “Refactoring”

#48

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 was a seminal book on software engineering for me.

Kind of like Effective C++, More effective C++, the old Win32 Charles Petzold book, GoF, etc.

To me, it was a classic, and much appreciated it as that was also when the whole TDD thing took off.

Re: Announcing the Second Edition of “Refactoring”

#49
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.

I typically start by adding some test cases or extract code (say as a function/method) add code to test it and keep repeating the cycle. I feel confident with this approach, especially with dynamiclly typed language like Python.

Re: Announcing the Second Edition of “Refactoring”

#50

This is intriguing, though personally I never connected much with Fowler's writing in the past (though I have gotten into his ideas ). Anyone know of any other good books about high-level design/architecture for javascript? Actually, thinking about it, maybe what I'm really looking for is something for designing/architecting things in dynamic/weakly typed languages... (Been doing JS for a bit now, but I spent much lo…

Thinking Forth [1]. Yes, it's Forth and not Javascript. But it covers pretty much the same territory as Refactoring plus some pretty deep discussions on program design/architecture, for a book originally written in the mid 80s.

[1] http://thinking-forth.sourceforge.net/ Although you can buy a copy on Amazon.

Post reply on HN