Piotr Gabryanczyk’s Blog

Java, Refactoring, AOP, Spring, DDD, TDD, etc.

  • Blogroll

    • I have joined Anti-IF Campaign

Archive for the ‘Blogroll’ Category

Friday School of Refactoring – Extract Method – video

Posted by Piotr Gabryanczyk on December 6, 2006

People still don’t use refactoring!

Some time ago I realized how many developers still don’t use simple refactorings like Extract Method or Replace Temp with Query etc. Many of them don’t know how excellent the development tools are these days. Simple one-click/keystroke operation can make their code much prettier and simpler.
I even heared once the opinion that “tools can not be trusted” as they can break the code while refactoring.
I don’t think it is the case especially with IntelliJ and Eclipse. These editors are quite smart and if used well can almost write the code for you 🙂 I know, I know I went too far…

Friday school of refactoring

I decided that I have to do something to change it. I started posting a weekly refactoring guide to my team-mates. Every week I pick some example from our system and make it simpler, prettier, easier to maintain – I refactor it. You could see one of the examples in my post Refactoring – conditionals.

Video

But reading emails full of code seems to be a bit boring, so this week I made a movie.
It shows the following refactorings:

  1. Extract Method
  2. Inline Variable/Replace Temp with Query
  3. Rename Variable

Show it to your team mates!
We can change the world together 🙂

Disclaimer:

I know that movie has a bug – extract method takes one line at the top too much…
I am too lazy to fix it… and not too many people spotted it 🙂

Advertisements

Posted in Blogroll, java, refactoring, video | Leave a Comment »