And behold, there came the time of Refactored Overloaded Objects
Posted: March 21st, 2004 Comments Off on And behold, there came the time of Refactored Overloaded ObjectsOh, prostate audiologist that crafty Cory Doctorow! Prancing around all la-di-da! “Look at me! I put my books on the web for free!” Ain’t he just the shiznit?
Yeah, well, his wasn’t the first big new science-fiction novel to be
given away free on the web, oh no! ‘Cos back in 1997, when I worked on Starship Titanic website, we gave away the entire text of the tie-in novel. (concept by Douglas Adams, book by Terry Jones)
That’s right. Every single word.
(Okay, now you have to go off and get the joke before you continue reading)
Well, okay, not every word, because we left off the last fifty and spun it into one of the web’s stupidest competitions (that was, remarkably, won). But we also showed the world how it was done, with PIPA – one of the silliest/coolest/most compact bits of Perl I’ve ever written.
Returning to Mr Doctorow, I notice that his first novel, Down and Out In The Magic Kingdom has been out in its new remixable form for a while now and not much has been done with it (other than a Russian translation), so it’s time to change that:
- Down and Out In the Magic Kingdom (CAPIPA Remix) – in which the original has its words reordered alphabetically, using PIPA’s new cousin, CAPIPA, which retains capitalisation. (Thanks for putting it online, Sean!)
“Beautiful,” BEAUTY beauty, became. BECAME because because because
because because because — because because because because because
because because because because because because because because because
become become become become become become become bed bed bed. bed bed
bed bed bed bed bed bed bed bed bed, bed bed bedroom bedroom
bedroom-bedroom beds bedside bedside bedside.
Down and Out In the Magic Kingdom (Sausages & Mash Remix)
– in which the original has all words beginning with the letters S and
M replaced with “Sausage” and “Mash” respectively, in accordance with
the classic children’s game.He chuckled. “No sausage, not mash. I’m into the kind of mash sausage that you only come across on-world.”
Down and Out In the Magic Kingdom (More And Bloodier Wars Remix) – in which the original is run through Babelfish several times, from English to French to German and back to English again. (With some help from Dan Urist’s WWW::Babelfish module)
I never thought that I would live, in order to arise, where the
maintenance would decide A-Movin ‘ Dan at the person in possession of
a favour light up to the death of the heat of the universe.
(Regarding
the bizarre disconnect between what spreadsheet applications were
originally intended to do and what they are used for now, buy the
surprising connection between Excel users and UNIX geeks, link and how I’m
standing out in the cold.)
Every few months I have a conversation
with my dad where he asks me to help out with something at the tiny
property business that he runs, and it’s almost the same conversation
every time. It goes like this:
Dad: Blah blah blah insurance blah blah blah ground rents blah blah blah so I just need your help with fixing the data in Excel so we can do a mail merge.
Me: But I don’t know how to use Excel.
Dad: What do you mean, you don’t know how to use Excel?
Me: I mean that I don’t know how to use it. It’s big and ugly and complicated and I get lost every time.
Dad: But that’s ridiculous. I don’t believe you. Everyone knows
how to use Excel. You’ve got a bloody computer science degree. How can
you not know how to use Excel?
Me: I’ve just never needed to use it.
Dad: Well, it’s about time that you learnt.
It’s no good, though. I learn about one new thing in Excel every
year. This year I learnt about AutoFilters. Trouble is, I’ll probably
have forgotten that by next year. At work we’ve just started using Joel Spolsky’s method of scheduling
which relies on Excel. Half the time it’s easy, because it’s just
editing numbers in individual cells. The other half of the time I need
to make a major structural change of some kind, like adding a row, and
Excel doesn’t like it when I do that. (At least, it doesn’t like it
when I try and do it more than once. I dunno.) As for things like
applying formulae, pfft. I realise that if you have even half a clue
then you can paint magical formulae all over your sheets with easy
swishes of the mouse like a left-brain Rembrandt, but half a clue is
still several times more clue than I have when it comes to Excel.
To be honest, I get a kind of old-fashioned-Luddite thrill from it. Earlier today I was trying to fix something on J-Colo so I was tailing logs and wandering through Mailman and qmail and piping things to wc -l
and generally acting in a way that suggested that, even though I’m not
a proper sysadmin, I could probably play one on TV. And I can switch
effortlessly back to Windows, which has been my main computing platform
since… ooh… 1993. I’m ready to grab any Windows app by the horns –
you just try and stop me! If you’re fronting and stepping to my mad
W1ndo$e skillz you won’t get very far – unless, that is, you throw
Excel at me, at which point I’ll don a flat cap and click things
randomly and whimper in pain, then mutter something about how we didn’t
need computers for these things in my day, and finally wander over to
the nearest marketing bloke and tug his sleeve whilst wearing my best
sad-puppy eyes.
If you’re in a similar boat to mine and you’re looking for a scapegoat, I suggest Bob Frankston. (I’d suggest Dan Bricklin as well, except that two years ago he wrote about my Yiddish piece and my fragile, easily-puffed ego is still glowing enough to mention it here. So I like him.)
In fact, if you’re looking for a scapegoat for the Personal Computer
Industry as a whole, then Frankston’s among the prime candidates. Back
in the late 70’s, Frankston and Bricklin created the first spreadsheet
app, Visicalc, based on an idea that Bricklin had when he was doing his MBA.
Back then, spreadsheets were in common use for financial
calculations, but were done entirely on paper; changing one of the
initial estimate values meant a new sheet of paper and an hour with a
calculator. Visicalc initially ran on the Apple ][ and was then ported
to a whole load of other machines, but it was on the IBM PC that it
made the biggest impact. There are wonderful stories of salesmen
demoing Visicalc to accountants who had no idea what a PC was or why
they would want one. The salesman would bring up an example
spreadsheet, ensure that the accountant recognised what he was looking
at, and then change one of the values, causing the change to ripple
through the rest of the sheet. The reaction to this was almost uniform:
the accountant’s mouth would hang open for a few seconds, then he’d
pull himself together and pull out his chequebook. Selling the PC to
the business world was that easy. The spreadsheet was the biggest of the legendary killer apps,
in the true meaning of the term: an application so utterly vital, so
revolutionary, that it can single-handedly sell the platform on which
it runs.
So the need to handle spreadsheets gave birth to spreadsheet
applications… but these days, 90% of the time, people are using them
for something else. My dad uses Excel as a lightweight database,
storing the details of all the ground rents he manages. I’ve seen Sean drag it out when he wants a random data munging job done quickly.
Chris and Dom have a mate who composes letters in it.
During this rant I had yesterday about mocking up UI using Visio someone said that they sometimes used Excel for that purpose as well. For crying out loud, this Japanese bloke has even made it play Pac-Man.
As Joel explains here,
the turning point came around Excel 5.0, which had to compete with
Lotus’s new app called Improv, designed to keep them at the top of the
spreadsheet market. The reason that Excel won and Improv failed was
that Improv was designed to make it much easier to do financial
spreadsheets, but Lotus hadn’t realised that people were now using
spreadsheet apps for a whole load of other tasks. The Excel team saw
this and exploited it, adding a load of features for non-spreadsheet
uses such as managing lists. Microsoft’s savvy about these things
extends to shipping an ODBC connector for Excel so that you can treat
an Excel sheet as a SQL database; “Sure, you should ideally be using
Access or SQL Server for that, but if it’s what you want to do…” (And
a year down the line: “Since you’re handling all your data over ODBC
already, you’d find it a lot faster if you moved to SQL Server…”)
Excel’s pervasiveness is not just as an application, but as a UI model. In our application
we have grid controls that can do smart column filtering. I thought
that explaining this to users would be a nightmare, until
near-identical functionality was pointed out to me in Excel, which all
our target userbase are already using on a daily basis. On a related
note, VIPS is the Excel paradigm wrapped around an image processing application, and apparently it even makes sense.
All of this speaks volumes about users’ habits when it comes to
dealing with new problems, preferring to use the tools they already
know which don’t fit quite as well as the tools built for the job but
which require extra learning. Some techies throw their hands up in
despair when seeing people use Excel as a database and scrabble to
teach these people SQL. Frequently, these are the same kind of techies
that are quite happy to keep large databases in text files on their
UNIX systems, dealing with them entirely through vi and the
CLI. As such, they should be taking heart: both groups are reducing
different problems to a common data format and toolset. Admittedly one
of them is proprietary and the other requires the use of arcane
commands like cut and sed but fundamentally they’re remarkably
similar. This kind of raw data-centric thinking is core to the UNIX
philosophy – more than that, it’s core to most models of computing.
Have software designers, in trying to provide a different, bespoke
interface for each task, missed a trick here?
Of course, I’m sure this isn’t news to anyone other than me. You’ve
all been using Excel happily for years, haven’t you? And there I was,
thinking I knew about computers. Doubtless, this is the kind of blind
spot that will see me begging for spare change within a couple of
years. Feh.
If
you’re a Perl coder who hasn’t been keeping a close eye on CPAN then
you may have missed the latest chunk of code making quite a stir, cialis
namely Brian “Ingy” Ingerson’s marvellous IO::All. And it is
marvellous: if Perl is the Swiss Army Chainsaw then this is the new
light saber attachment – can’t do anything you couldn’t do previously
but it slices through most IO jobs in one or two lines, no rx from file
slurping (one line, medications obviously) to creating a forking server (er, two
lines). This Perl.com piece
would be a great introduction if another burst of coding from Ingy
hadn’t rendered it half-obsolete a mere three days later. But, dammit,
that’s what we like to see!
IO::All’s design could be described, for want of a decent OO
education, as “overload one class with a billion different uses” and in
this case it seems to work well. The vast majority of the code revolves
around grabbing code from other modules and wrapping them up in several
big contextualising switches so that this single class is almost all
you need for your to-ing and fro-ing with the outside filesystem. In
other words, it’s all about the interface. It feels very Perlish in its
mixture of minimal code and DWIMness so it’s not surprising that many in the Perl community have jumped on it gleefully.
This “The Best $DOMAIN Functions In The World… Ever!” approach to module-building is infectious, and Yung-Chung Lin’s Var module is probably going to be the first of many imitators. If you fancy having a go yourself, then Ingy’s Spiffy
base class is what you want to start with, but please use your enhanced
exporting powers wisely: packing a single class with tons of functions
(a la Python) is fine and pretty, but doing that to the default
namespace (a la PHP) is just inconsiderate.