Skip to content

Direct translation of the book "31 days of refactoring" by Sean Chambers, Simone Chiaretta from .net to Java

Notifications You must be signed in to change notification settings

sunnypatel165/31DaysOfRefactoringInJava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 

Repository files navigation

31DaysOfRefactoringInJava

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

Contents:

Day 1 - Encapsulate Collection

Day 2 - Move Method

Day 3 - Pull Up Method

Day 4 - Push Down Method

Day 5 - Pull Up Field

Day 6 - Push Down Field

Day 7 - Rename

Day 8 - Replace Inheritence with Delegation

Day 9 - Extract Interface

Day 10 - Extract Method

Day 11 - Switch To Strategy

Day 12 - Break Dependencies

Day 13 - Extract Method Objects

Day 14 - Break Responsibilities

Day 15 - Remove Duplication

Day 16 - Encapsulate Conditional

Day 17 - Extract Superclass

Day 18 - Replace Exceptions With Conditional

Day 19 - Extract Factory Class

Day 20 - Extract Subclass

Day 21 - Collapse Hierarchy

Day 22 - Break Method

Day 23 - Introduce Parameter Object

Day 24 - Remove Arrowhead Antipattern

Day 25 - Introduce Design by Contract Checks

Day 26 - Remove Double Negative

Day 27 - Remove God Classes

Day 28 - Remove Boolean Method

Day 29 - Remove Middle Man

Day 30 - Return ASAP

Day 31 - Replace Conditional With Polymorphism

Motivation

About

Direct translation of the book "31 days of refactoring" by Sean Chambers, Simone Chiaretta from .net to Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages