Team Murder No Brain No Headache.

24Aug/06Off

I’d Rather See Recyclable Software

I spent a little time on the bus ride this morning reading and mulling Alex Bunardzic's post on disposable software which is a huge lump of information and insight to chew on but it also got me thinking about some things perhaps tangential to some of the things he talked about. In my own admittedly limited experience I've found the reuse of code to wildly vary in terms of usefulness. Most of the actual work I do in a text editor these days revolves around forms and the scripts necessary to do something with them so I'm at least 89% talking out of my ass here but I've run into similar circumstances with larger chunks of code (like writing my own web server instead of just using whatever was rolled into a CMS) and liked it even less. In my current place of work there is a weird premium placed on the ability to do any programming work since we're essentially in place as phone 'bots and not expected to know a whole lot more than that. The fact that I can churn through a script that doesn't really do a whole lot in twenty minutes is considered pretty valuable by some folks for reasons I can't really figure out without chalking out a pentagram and summoning up some management types to explain things to me.

I haven't used a whole lot of old code because, to begin with, everything is written in Perl by students who are more interested in learning language features and implementing each and every one of them exhaustively into their current project than writing anything resembling maintainable code. I can't really say that I blame them for wanting to learn about the more fun and sexy aspects of a given language but it makes navigating what they have written miserable even with the help of incredibly verbose but simultaneously useless comments. Every function written is to explore a particular aspect of functionality within the language and doesn't actually promote reuse. That single use philosophy permeates throughout the entire chunk of Perl and makes it very difficult to isolate and reuse anything. That sort of inertia that comes along with writing functions and using built in features for the fun of it tends to extend to everything associated with it.

Comments are another part of the puzzle that puzzles, baffles, and annoys: some of the people churning out this mess are computer science students and don't seem to understand the most basic thing about the purpose of comments other than when they've been instructed to insert them. While this makes for a pleasant distraction from the convolution and disorganization that is normally associated with the 'I'm learning the whole language by writing this script' methodology it doesn't help anyone including the person hunting and pecking their way through an O'Reilly book.

What I'm trying to get to here although I'm being somewhat distracted by random anger flashbacks is that most truly disposable software is designed without any intent to design that software. Languages like Perl are ideal for the throwaway stuff as rewriting a simple implementation of something that does one job and only one job well is pretty trivial if you're acquainted with the workings of the language and aren't just editing book examples around the problem you're trying to solve or if the problem is a one time occurrence like sorting a huge data set or doing a bunch of repetitious operations on files that need are currently in some weird format that gives you a headache when contemplated for longer than it takes to write a regex to sanitize or at least sanity-ify. You really shouldn't be doing this.

I also agree that huge and industrial strength applications that solve every aspect of a particular problem but are not readily adaptable to solving the other problems that invariably result is basically building higher and more impressive piles of shit that will likely fall over and leave shit stains on your pant leg. This may or may not be attributable to the divine hand of $DEITY vengefully spinning the wheel of karma. I don't know how much of my own belief can be chalked up to complete and total UNIX bigotry but I would rather have a bunch of tiny robots that do one job well and play nice with one another when necessary or can be edited and renamed when some of their functionality is needed for another task. That part of the *nix philosophy is what appeals to me the most: build a workable system that can run the world out of small parts that can be replaced and refined when they are improved but don't break everything in the process. The point for me is to not keep reinventing the wheel and doing a crappy job each time you start from scratch. It just seems like a tremendous waste of human effort to make discreet applications that do singular jobs without thinking ahead ten days and realizing that you're going to do the same stupid thing again and again. Of course, if you're going to live to be 350 years old and get all of the hours back that you've wasted in a gift wrapped box on your deathbed I totally understand. I think the really important question to ask is whether you will ever do variations on a similar task again. I will take an extra fifteen minutes working that angle and it has saved me time and suffering in the past. If your code is truly disposable and can be discarded immediately after it is used then why are you writing a program to do it?

Application scripting, as many people who are otherwise woefully/joyfully unacquainted with larger scale programming are often frighteningly familiar and comfortable with, is probably a better implementation of this sort of stuff. Do people often reuse VBScripting routines and mega-macros? I think it is more unintentional passage from one set of hands to another but those mini-languages also seem more likely to be constructed with an application level interface to the actual code than straight programming languages and more likely to be modified successfully by non-programmers. Anyone got any good/bad examples of this at work?

Filed under: General Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.