Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Programming *is* much more than "just writing code".

by Rhandom (Curate)
on May 08, 2007 at 20:53 UTC ( #614247=note: print w/replies, xml ) Need Help??


in reply to Re: Programming *is* much more than "just writing code".
in thread Programming *is* much more than "just writing code".

I cannot tell you how many times I've heard "This program worked fine until the last time we had it modified by our usual programmer, and ever since it works fine most of the time but every now and then doesn't work at all"

My usual follow up to conversations like these is something like: "Good thing you now have extensive unit tests around your code. You do have unit tests around your code right?"

Any recent system I've worked on has a test suite. "I" understand the code "I" have written and "I" have broken the code when "I" though "I" knew what "I" was doing. Commenting or not has little to do with the situation. It is good that I've had revision control and unit tests to figure out what I broke, how to fix it, and how to check that everything still works.

That really should be done in maintenance mode as well - find all of the existing use cases, wrap them up in a unit test file. Make sure that test file works as you progress in your changes.

Oh - and be sure to leave a comment for why you chose the new algorithm that you implemented. :)

my @a=qw(random brilliant braindead); print $a[rand(@a)];
  • Comment on Re^2: Programming *is* much more than "just writing code".

Replies are listed 'Best First'.
Re^3: Programming *is* much more than "just writing code".
by gloryhack (Deacon) on May 09, 2007 at 01:01 UTC
    It's not often that I consent to inherit someone else's problem code, but when I do there's an economic reality to be considered. If the client's cap is at four hours of labor (billed), I'm not going to spend 40 hours writing tests. I don't provide charity to commercial enterprises aside from that extorted by the IRS to be doled out as corporate welfare.

    I always comment non-obvious design decisions, by the way. Those are comments that might actually be useful to the competent maintenance programmer who's been tasked with refactoring my code. I frequently include URI's for in-depth discussions of the algorithms that might not be known to programmers at large. If I've optimized the code, I'll frequently include benchmark results to show that the code has been optimized at the right point in the development cycle. But I'm not going to take on the role of educator to explain to a maintenance programmer why I've chosen to implement a database connection as a singleton, or memoized a recursive method that can benefit from it. He already knows why, or can do his own homework, or can take the job he's best suited for down at the car wash. I can't save the code or the client from him and it's not my job.

    While I value good code and sound professional practices, I'm really not going to lose any sleep over what happens two years down the road when some cheap client hands my code over to some high school kid who's only worked through the first four chapters of Learning Perl. Not my problem, not my job. If I'm for some reason deemed not quite good enough to do the work, then that squeaky voiced kid who calls to ask "Yo, Gee, w'sup widdis singleton shizit?" had darn well better be. He dialed the wrong number and is on his own.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://614247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2020-10-28 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (259 votes). Check out past polls.

    Notices?