Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

grantm (164)

grantm
  (email not shown publicly)
http://www.mclean.net.nz/

Just a simple [cpan.org] guy, hacking Perl for fun and profit since way back in the last millenium. You may find me hanging around in the monestary [perlmonks.org].

What am I working on right now? Probably the Sprog project [sourceforge.net].

GnuPG key Fingerprint:
6CA8 2022 5006 70E9 2D66
AE3F 1AF1 A20A 4CC0 0851

Journal of grantm (164)

Wednesday October 19, 2005
07:53 PM

Code Reuse via Cut 'n Paste

[ #27250 ]

A bit of background...

Some years ago I attended a marketing presentation for the (then) shiny new release of MS Visual Studio. The rep proudly demoed a library function which "allowed easy copying/pasting of frequently used code snippets" which was supposedly a good idea because it would "promote code reuse". I remember thinking at the time That sounds like a maintenance nightmare in the making.

A different bit of background...

A common approach to adding functionality to a working system is:

  1. Copy the existing functionality (one or more of: subroutines, modules, templates, tables etc) which most closely resembles the desired new functionality
  2. Modify the copy to do the new thing
  3. Refactor aggresively to eliminate redundancy

Note, I didn't say it was a good way, just a common way. Unfortunately it's a particularly poor approach if step three is never executed.

This week in my life

The client requested a simple change. At various points in their app, objects displayed on screen are highlighted in a colour which indicates the states of four flags. The flags are all independant, so there is a specified priority order for applying colours. The client simply specified a change the priority order.

I am now into day four. I have edited 86 files and the patch (including context and other diff overhead lines) is now standing at 3359 lines.

And yes, I am executing step 3.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Some friends and I mused about the idea of an Eclipse plugin that would watch for pastes. After the second paste of the same code, the plugin would cause a light to go on or a buzzer to sound, signaling the need for a code review.