Refactoring exercises in Java

kms333 picture kms333 · Mar 21, 2012 · Viewed 8k times · Source

I have just been through the following paper and I found it extremely useful: http://www.objectmentor.com/resources/articles/Clean_Code_Args.pdf

I am looking for similar papers/books/tutorials/etc. that provide step-by-step practice on refactoring and/or correct class design. I have read Fowler's “Refactoring”, but I was looking for more substantial examples.

Answer

Rangi Lin picture Rangi Lin · Mar 21, 2012

You probably won't find much resource about refactoring large examples step by step. Because you can never cover all types of example.

The reason Martin Fowler use small and easy example in "Refactoring", is because almost every large chunk of bad code are a combination of different bad smell. By learning how to recognize particular bad smell, you can fix the code gradually.

I will recommend you check Working Effectively with Legacy Code. It's a book that focus on the strategies to improve large legacy code. For class design, you probably want to read some books about design pattern.

Most important, try to apply things you learn in the book to your code.