Over a million developers have joined DZone.

Refactoring Spikes as a Learning Tool and How a Scheduled Git Reset Can Help

· Java Zone

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

To learn how complex your code base really is and how much effort a particular refactoring might require compared to the initial expectations, follow these steps:

  1. Schedule git reset --hard; git clean -fd to run in 1 hour (e.g. via cron)
  2. Do the refactoring
  3. WT*?! All my changes disappeared?!” – this experience indicates the end of the refactoring :-)
  4. Go for a walk or something and think about what you have learned about the code, its complexity, the refactoring
  5. Repeat regularly, f. ex. once every week or two – thus you’ll improve your ability to direct the refactoring so that you learn as much as possible during the short time

The exercise has been recommended by Kent Beck, I’ve just added the scheduled reset because my discipline is not strong enough to resist the likely urge to continue “just little further” and to keep the code if it looks any good. (If I become absorbed in the refactoring so much that I’ll forget to stop on time then I’ll surely also forget about the reset and thus the tendency to just cancel it won’t stand a chance.)

Notice that if you do any larger-scale refactoring, it might be pretty wise to apply the Mikado method to help you keep track of where you are going and where you are while also keeping your buildable.

When I get to try this out I might write about my experiences here as well.

 

From http://theholyjava.wordpress.com/2011/11/21/refactoring-spikes-as-a-learning-tool-and-how-a-scheduled-git-reset-can-help/

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}