Most part of my job is to work on a piece of code that's already written by someone. When I read such code, I often like to think(sometimes actually do) about changing things to make the code better. And I also wonder, how a piece of code I am writing today, will be changed by someone else in future. Coz that's what a lot of jobs demand - to be able to re-use/improve/extend code already written.
So I thought of reading a bit about Refactoring, and upon googling, I came acorss this book called 31 Days of Refactoring by Sean Chambers, Simone Chiaretta. It is a great book - clear and concise. It has one lesson per day, but you can really finish the entire book in a day.
The book is originally written for .net as a language. And hence, I took up the task of learning the lessons as given in the book - one per day. But, I also started converting them to Java.
This repo is a literal translation of the book called 31 days of refactoring. Now, a lot of the lessons - like the 1st one - feel very obvious to a Java developer. Those who have read Effective Java might find this a waste! But the point is not to teach Java, it's about engendering the thought of Reafctoring and what to keep in mind while doing it yourself!
I will try to add one lesson each day!
Feel free to contribute! :D
Day 1 - Encapsulate Collection
Day 8 - Replace Inheritence with Delegation
Day 13 - Extract Method Objects
Day 14 - Break Responsibilities
Day 16 - Encapsulate Conditional
Day 18 - Replace Exceptions With Conditional
Day 19 - Extract Factory Class
Day 23 - Introduce Parameter Object
Day 24 - Remove Arrowhead Antipattern
Day 25 - Introduce Design by Contract Checks
Day 26 - Remove Double Negative
Day 28 - Remove Boolean Method