Menu
Menu
Code Of Practice

Code Of Practice

Refactoring consists of a number of patterns that have formalized what software developers "just did" in the past, according to Garlick. Formalizing these refactoring practices gives software developers a clear set of steps to follow in making changes, ensuring it is harder to overlook a required step and further minimizing the chances of introducing a bug. Having clear steps to follow also makes it easy for development tools to provide automated support for refactoring, allowing the software developer to say "I want this change made" confident he or she has the tools needed to manage the detail.

"A common tendency for software developers is to change the structure and make the new modifications all at the same time," Garlick says. "Such major changes are difficult to make without introducing bugs ('regressions'), and because of the scale of those changes, locating the source of any bug is also difficult. By applying refactoring first (before making the new modifications), any existing tests (in particular unit tests and automated test scripts) can verify that the system has not been broken. If any bugs are introduced, they are easy to locate and fix because of the smaller scale of the changes made."

But if the techniques themselves are old, and small refactorings have been done as long as people have been writing programs, the term itself has also been around for some time. It arose out of the Smalltalk community - the pioneers of many object-oriented techniques - in the 80s. The recent rise in the popularity of the term has to do with the simultaneous increase in interest in agile methodologies, and particularly extreme programming.

Transformational Tool

While reworking code has been common practice since software's earliest days, refactoring takes the practice to a different level altogether.

Eric Raymond, author of The Cathedral and the Bazaar - the collection of essays that has been credited with persuading Netscape to release its browser as open source, and putting Linus Torvalds on the cover of Forbes magazine and Microsoft on the defensive - sees refactoring as part of the process that is turning software engineering from art to science, much the way alchemy eventually led to chemistry.

"I'm beginning to think that from the wreckage of the software industry big dumb management made, I can see the outline of a mature, humane discipline of software engineering emerging - and that it will be in large part a fusion of the responsiveness and customer focus of the agile movement with the wisdom and groundedness of the Unix tradition, expressed in open source," Raymond has said.

Aberdeen Group predicts that despite the hype of recent years, it is "refactoring", not "reusability", that will truly lead the way to improved programmer productivity (http://www.aberdeen.com/ab_abstracts/2003/01/01030010.htm). After reviewing the evidence, Aberdeen concludes encouraging reuse in today's toolsets is having little positive effect on productivity - and sometimes even a negative effect - because development tools suppliers and users alike have mistaken a possible means (reuse) for a goal (faster, repeated delivery of software value-add to the customer).

Aberdeen now calls the over-focus on reusability what it is: A harmful waste of IT buyers' and developers' time. By contrast, it concludes that while refactoring has a slightly negative effect on project time in initial application development, from that time forward it can dramatically affect programmer productivity.

"Moreover, refactoring can help users avoid 'software sclerosis', in which legacy applications become more and more difficult to upgrade to new technologies and hence more and more costly to maintain," Aberdeen says, although it notes a paucity of true refactoring tools to date.

Dr Peter J Kootsookos, a lecturer at University of Queensland School of Information Technology and Electrical Engineering, says the practice was more common in Ireland, - one of the top three software exporters in the world - when he worked there than it is here in Australia. He says refactoring should become one of the tools of every company doing software development, to be used as and where appropriate.

Join the CIO Australia group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

More about Aberdeen GroupAddison-WesleyADVENTAgile SoftwareBillionC2Carnegie Mellon University AustraliaCGIForbes MagazineHISIBM AustraliaJohn Wiley & Sons AustraliaMellonMicrosoftOracleSabre CorpSpeedSuncorp GroupSUNCORP-METWAYThoughtWorksTurnAround SolutionsUniversity of QueenslandUniversity of Queensland

Show Comments
Computerworld
ARN
Techworld
CMO