Archives / 2004 / May
  • The true origin of "foo" and "bar" as canonical programming conventions

    One thing that's perplexed, entertained and escaped me for years as a professional developer has been the reason why so many people in the programming community use “Foo” and “Bar” as their examples when showing how to do something.  I've seen this de facto convention applied mainly towards explaining object-oriented principles, but it's gotten so popular, it's right up there with “Hello world!” as a ubiquitous sample in all forms of writing software you just can't get away from (class names, variable assignment, database username/password combinations, temporary filenames, security credentials, etc.).

    I'm sure there's a decent reason for why someone out there decided to start using those particular words, but here's my theory: the big-budget 1989 action movie “Tango and Cash”.  In the film, actor Kurt Russell says something along the lines of describing a less-than-desirable situation he and Sylvester Stallone are in as “FUBAR”, being an acronym for “Fucked Up Beyond All Repair”.

    How this came to be so widely used in programming circles I'm not sure.  It's not kept me up nights, but the phrase stuck with me through my youth (plus the fact that I worked at Blockbuster kept it in constant mental rotation).  You can imagine my amusement when I got into development work and found it used liberally in book after book, tutorial after tutorial, across platforms and vendors.  A UNIX training course I attended years ago used this for each and every example presented, without deviation, so much that at one point I thought Foo and Bar were either commands, directories or daemons for SunOS.  Heck, I've even used it a couple of times myself.

    I'm sure someone out there has a valid explanation, but this has always stuck me as funny.  If you know the answer, do drop me a line...I'd love to find out once and for all.


  • Sometimes simpler is better

    In this, a world of ever-changing developmental practices and procedures, I often try to remind myself of the principle of Occam's Razor, which, loosely translated states that sometimes the perfect solution for the most complex situations is the one most obvious to us.  As someone who majored in marketing in college, and then concentrating on that discipline again in graduate school, it helps to apply a little common sense when working knee-deep in sophisticated projects.

    To illustrate this point, I've got a perfect example from a good friend: ASP.NET laureate Steve Smith.

    I recall the “early” days of ASP.NET development, as Steve's ASPAlliance site really started to take off.  Myself an aspiring ASP.NET developer, I started writing tech book reviews and the occasional programming tutorial.  I discovered when submitting content to Steve's site that I could inherit his site's formatting and layout by calling two XML web services - one “header“ call for all HTML above an HTML table cell for static content and a corresponding “footer“ call which filled in the gap towards the bottom of the page.  The web service calls just returned pre-formatted HTML to create the page, and could be changed by Steve at any time as he see fit and as his site inevitably grew.  Surely, this wasn't a landmark achievement of modern computer science, and there are certainly more elegant, more fitting ways of doing the same thing.  But I instantly appreciated its importance - and, more importantly, its simplicity.

    This came in stark contrast to (and continues to be a model lesson) some other community-oriented sites, which let people submit their own works, but in doing so needed to format and apply markup to content, which in some cases required knowing a site's CSS specifications, which wasn't too hard, but unnecesarily troublesome.  Content management systems are vast, complex things that normally obfuscate such trivial operations, but we can all learn from Steve's foresight in doing something very easy.

    I know I did.  Thanks, Steve.


  • Idea exchange: any developers want to pow-wow about building election-oriented apps?

    I've been involved with elections for years - as a general participant, as a developer and as part of the media.  So, I've got some experience with the general format and “business rules“ employed when working with that sort of data.

    With this being an election year, I've interacted with a couple of people already who work at the state, national or territorial level, building applications to help ramp-up knowledge about everything from candidate profiles to real-time results generators.  As such, I think it would be great to develop a mailing list for people to bounce ideas off of each other to get the most out of their work.

    I've done several of these type of apps, and with this years being my third election covering elections from the standpoint of broadcast media, I've migrated from manually copying-and-pasting resuls in Excel into static FrontPage documents, to building fully-automated, multi-platform, multimedia application frameworks.

    I'd like to share my experiences with you - good and bad - and perhaps hear what you've got to day about building election-oriented applications for the Web.  If there's anyone out there who'd like to exchange ideas, architectures and code for doing these type of projects, I'd be happy to start it up.


  • Classic KISS: explaining SOAP functionality in plain English by the media

    Having the perspective that I do on technology (writing code 10 hours a day and then being a tech journalist the other 8), I get to gain an appreciation for the power of words and how they're used.  Or, as is done so commonly, misused.

    I have the utmost respect for those brave men and women who pioneered the SOAP specification.  They're better people than I; way smarter and more patient.  It's those who came after them, the product managers and tech evangelists and media archetypes writing countless articles, tutorials and journals, trying to explain the concepts of a technical concept, that have screwed the whole thing up for us non-genius lesser mortals.  I've staked my claim in the industry as being a guy who can make the complex seem easy, so this irks me a little more than just a bit.

    An example of this classic snafu was realized recently when I was researching SOAP's routing capabilities in .NET, namely, through WS-Routing.  I came across a curiosity I sought to explain better: the real reason/purpose/function for the <ACTION> element within a SOAP request message.  The technical definition explains that the element contains a URI, explaining within the message processing pipeline the SOAP message's “intent“.  It seems that most people writing about it don't deviate too far from the spec's description of the element's use, being the intent of the message, and needing to be a URI.  Duh! 

    It's funny how something so fundamentally simple can be so misconstrued.  There really isn't a plainclothes description of what purpose the intent would serve, other than being a placeholder for some other use, which I can't seem to find.  But that's not the point I want to make.

    Visit the SOAP routing specification for routing for the technical layout, and then try Googling the topic and see how many newsy articles you find that basically regurgitate the same non-descript, safe zone explanation of what the <ACTION> element is really used for, other than intent:

    The URI, then, is basically a placeholder indicating a locale, which need not be existing on a network.  So does this mean that I could realistically use the following URI in my SOAP message, as the intent of the message?

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="">
        <mp:path xmlns:mp=""
         SOAP-ENV:actor="" SOAP-ENV:mustUnderstand="1">
          <!-- <mp:action> nonexistingmethod/</mp:action> -->


    I may be missing something fairly obvious and ranting and raving about something that I just missed...and this is key.  There's simply not enough laymen's terms work out there that'll make the complicated easily understandable.


    So in short, what I'd like to see from my compatriots in the media is more tolerance for those who don't have M.S. degrees in software engineering and a more proactive attitude towards laying out what we should learn.


  • My next MSDN article (which is actually my first)

    Top 'O the World, Ma...

    I'm stoked beyond all comprehensible description to see my first MSDN article published!  It basically started as the residual result of project creep as I was working on a wireless web app several weeks ago, and just blossomed.

    Kent Sharkey was nice enough to mention my little accomplishment, and gave my efforts to be the undispited King of All Media (with aplogies to Howard Stern, of whom I'm a big fan anyway) a nice little plug.  It's nice to be recognized as the dude who's on TV, the radio and the Web.  Also giving me giggles is being mentioned in the same breath as Scott Mitchell, who clear, concise writing I've been a fan of for years.  Damn...whodathunkit?

    You know, after writing professionally for more than 8 years about everything from software engineering to government corruption to the historical context of pro sports to the heights of human emotion to the depths of social tragedy, I still enjoy seeing my work published in well-known journals.  That I've got these funny thoughts on my head and people would take time outof their days to read them and comment, good or bad, never gets old for me.  I'm glad I can make someone's day just a tad better by jotting down what little ramblings I've got.  One thing's for sure...this is going to look sweet on Ye Olde Resume.

    Hope you like it!


  • Viva capitalism: some dude is making money selling a URL-shortening service

    Someone noticed a post on the ASPAdvice mailing lists in which I referenced several MSDN URLs, and then sent me a link to his service, currently in beta, for shorterning URLs, making them work better in the world of word-wrapping mail clients:

    It's quite an interesting idea, and the service indicates it's got plans to do other things.  This is apparently one of several such services popping up.  Neat.

    But before you write this off as a kooky idea...remember, the same was said when a certain former Wall Street financiual worker named Bezos thought he could sell books on the Web...