Source Control That Explicitly Understands Refactorings
Learn to use PlasticSCM, a source control management system that understands refractoring, thanks to several helpful videos and examples.
Join the DZone community and get the full member experience.Join For Free
i blogged in 2013 on some features i would love source-control tools to-have . one excerpt:
[…] taking it further, a source-control tool at the top level, should also be able to understand “method rename” (and other refactorings), rather than a series of adds and deletes. another example is “method reorder” where one method/function is moved below another. there are many others that are closer to our understanding of refactoring operations.
there’s some back history, in that i paired with lucas ward on a source control maturity model in 2010, and that’s where we came up with a cmm inspired levels 1 through 5 for source control tools. the more recent “refactoring awareness” was to be level 6.
source-control that explicitly understands multi-file refactoring is here. only in plasticscm for now, and it’ll come later for all others i guess. hopefully not for clearcase <spit/>, though. the plasticscm have been playing with for a while now – first getting it working inside single source files (method moved up or down in c#) with their semanticmerge technology. now they have it working for java and c too, and accross multiple source files . here’s part of the built-in gui for a c# refactoring:
pablo santos has made some videos of the capability in use on windows after some visualstudio + resharper refactorings:
1. a “very short intro” (2 mins):
2. a slightly less short intro (4.5 mins):
what refactoring looks like in the hands of a master
while i think it would be the business of the ide makers (gotta love jetbrains) to supply metadata to scms as refactorings happen in the workspace (versus the previous revision), pablo’s team has implemented this as a feature within the scm client, as they can’t wait for ide makers to play ball. that means they’ve had to implement a bunch of refactoring-sniffing logic, and it implies that there’s a bunch of refactorings that can’t be tracked (yet). intellij and java are the high-bar for discrete and bulletproof refactorings, and there are a lot of refactorings on its menu, than there are on their other products pycharm, rubymine and webstorm (etc).
refactorings is a very hard topic for the ide makers. here’s what they all have to aspire to (if you’ve a short attention span fast-forward to 1min 10secs):
that was former colleague, danilo sato in 2011, demonstrating perfectly safe refactoring at relatively high speed in a “14 minute video”. more on his blog entry about that . anyone who uses the term refactoring should watch that. as i said, intellij idea is the high bar for refactoring operations, and jetbrains can’t do as much for the dynamic languages. for example “extract parameter” (as danilo showed it a few times) is comparatively disabled in their otherwise excellent pycharm ide.
martin fowler on refactoring at oscon a couple of weeks ago
though i was in portland, i missed martin’s presentation as i was in an interview for hedgeserv’s new portland r&d office (sorry martin). however now the video is out, i can play catch up, and martin nails it on architecture generally (14 mins):
martin shows a chart, part way through. a simplified version of:
(from his bliki entry designstaminahypothesis )
anyway, you get above that line, by not building up technical debt. you get above that line by doing refactorings, as you need to. stacy curl pointed out years ago that there’s not more useful refactorings to do, you’ve reached a desirable state called “most stable” for the codebase. ward cunningham, the grand-pappy of modern programming, suggested that dependency injection was the way architecture could be fluid on a timeline with good xp/agile practices, rather than etched in stone as it is for the architecture of buildings. ward was promoting the practice of injection, and was not suggesting that di containers were a mandatory part of that. i blogged on both of those too, if you still have the energy to read more:
Published at DZone with permission of Paul Hammant, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.