DaedTech

Stories about Software

By

Poor Man’s Code Contracts

What’s Wrong with Code Contracts?!?

Let me start out by saying that I really see nothing wrong with code contracts, and what I’m offering is not intended as any kind of replacement for them in the slightest. Rather, I’m offering a solution for a situation where contracts are not available to you. This might occur for any number of reasons:

  1. You don’t know how to use them and don’t have time to learn.
  2. You’re working on a legacy code base and aren’t able to retrofit wholesale or gradually.
  3. You don’t have approval to use them in a project to which you’re contributing.

Let’s just assume that one of these, or some other consideration I hadn’t thought of is true.

The Problem

If you’re coding defensively and diligent about enforcing preconditions, you probably have a lot of code like this:

public void DoSomething(Foo foo, Bar, bar)
{
  if(foo == null)
  {
    throw new ArgumentNullException("foo");
  }
  if(bar == null)
  {
    throw new ArgumentException("bar");
  }

  //Finally, get down to business...
}

With code contracts, you can compact that guard code and make things more readable:

public void DoSomething(Foo foo, Bar, bar)
{
  Contract.Requires(foo != null);
  Contract.Requires(bar != null);

  //Finally, get down to business...
}

I won’t go into much more detail here — I’ve blogged about code contracts in the past.

But, if you don’t have access to code contracts, you can achieve the same thing, with even more concise syntax.

public void DoSomething(Foo foo, Bar, bar)
{
  _Validator.VerifyParamsNonNull(foo, bar);

  //Finally, get down to business...
}

The Mechanism

This is actually pretty simple in concept, but it’s something that I’ve found myself using routinely. Here is an example of what the “Validator” class looks like in one of my code bases:

    public class InvariantValidator : IInvariantValidator
    {
        /// Verify a (reference) method parameter as non-null
        /// The parameter in question
        /// Optional message to go along with the thrown exception
        public virtual void VerifyNonNull(T argument, string message = "Invalid Argument") where T : class
        {
            if (argument == null)
            {
                throw new ArgumentNullException("argument", message);
            }
        }

        /// Verify a parameters list of objects
        /// 
        public virtual void VerifyParamsNonNull(params object[] arguments)
        {
            VerifyNonNull(arguments);

            foreach (object myParameter in arguments)
            {
                VerifyNonNull(myParameter);
            }
        }

        /// Verify that a string is not null or empty
        /// String to check
        /// Optional parameter for exception message
        public virtual void VerifyNotNullOrEmpty(string target, string message = "String cannot be null or empty.")
        {
            if (string.IsNullOrEmpty(target))
            {
                throw new InvalidOperationException(message);
            }
        }
    }

Pretty simple, huh? So simple that you might consider not bothering, except…

Except that for me, personally, anything that saves lines of code, repeat typing, and cyclomatic complexity is good. I’m very meticulous about that. Think of every place in your code base that you have an if(foo == null) throw paradigm, and add one to a cyclomatic complexity calculator. This is order O(n) on the number of methods in your code base. Contrast that to 1 in this code base. Not O(1), but actually 1.

I also find that this makes my methods substantially more readable at a glance, partitioning the method effectively into guard code and what you actually want to do. The vast majority of the time, you don’t care about the guard code, and don’t really have to think about it in this case. It doesn’t occupy your thought briefly as you figure out where the actual guts of the method are. You’re used to seeing a precondition/invariant one-liner at the start of a method, and you immediately skip it unless it’s the source of your issue, in which case you inspect it.

I find that streamlined contexting to be valuable. There’s a clear place for the guard code and a clear place for the business logic, and I’m used to seeing them separated.

Cross-Cutting Concerns

Everything I said above is true of Code Contracts as well as my knock off. Some time back, I did some research on Code Contracts and during the course of that project, we devised a way to have Code Contracts behave differently in debug mode (throwing exceptions) than in release mode (supplying sensible defaults). This was part of an experimental effort to wrap simple C# classes and create versions that the “no throw guarantee”.

But, Code Contracts work with explicit static method calls. With this interface validator, I can use an IoC container define run-time configurable, cross cutting behavior on precondition/invariant violations. That creates a powerful paradigm where, in some cases, I can throw exceptions, in other cases, I can log and throw, or in still other cases, I can do something crazy like pop up message boxes. The particulars don’t matter so much as the ability to plug in a behavior at configuration time and have it cross-cut throughout the application. (Note, this is only possible if you make your Validator an injectable dependency).

Final Thoughts

So, I thought that was worth sharing. It’s simple — perhaps so simple as to be obvious — but I’ve gotten a lot of mileage out of it in scenarios where I couldn’t use contracts, and sometimes I find myself even preferring it. There’s no learning curve, so other people don’t look at it and say things like “where do I download Code Contracts” or “what does this attribute mean?” And, it’s easy to fully customize. Of course, this does nothing about enforcing instance level invariants, and to get the rich experience of code contracts, you’d at the very least need to define some kind of method that accepted a delegate type for evaluation, but this is, again, not intended to replace contracts.

Just another tool for your arsenal, if you want it.

By

Scheduled Task Problems And Solutions in Windows 7

This is going here for my own sake as much as anything. I’ve been banging my head against a wall for a bit now, trying to figure out why I can’t get a scheduled task to run properly in Windows 7. Two things were going wrong. The first one was that I couldn’t get the start-in setting to work properly. This is neatly explained and addressed in this post.

Long story short, unlike everywhere else in Windows, the “start-in” text box randomly doesn’t demand or even support quotes around directory names with spaces in the paths. So, just remove the spaces.

Second issue I was having was that I was running a task to execute a program I had written that reads an XML config file to point it to files to use. One of these files was addressed by a mapped network drive. This worked fine when I ran the actual executable, but after a lot of bad noise and experimenting, I discovered that it wouldn’t work with the scheduled task. For the scheduled task, I had to use the UNC path to the file in my XML configuration file. I can only speculate that this has something to do with the scheduler not being tightly coupled enough to owning user to share network drives or something.

In the end, doesn’t matter. It’s kind of weird, but for anyone who finds themselves in that edge-case situation, try dealing with UNC exclusively.

By

Home Automation

Mea Culpa

As is alluded to once or twice on my sight, my main area of interest is in home automation. I’ve been somewhat mum about this interest in the blog, as my time over the last year has been spent refining this site, working on some open source tools, completing my MS degree, and, oh yeah, working 50+ hours per week programming to pay the mortgage. However, now that the site is somewhat established, business is good, and my MS degree complete, I’m planning to give this the focus that I’ve intended. So, I’ll be doing some posts about home automation in the hopes of drumming up some interest in the public at large in what I believe is a (too slowly) emerging trend.

What is Home Automation

http://www.cartoonscrapbook.com/03pics/jetsons05.jpg

Many people, and probably most techies, have heard of and are at least vaguely aware of the concept of home automation. The idea that most would throw out there is that one can control lights and perhaps some other goodies in the home without actually, manually getting up to toggle a rocker switch. A very simple example of this is The Clapper, a device that allows someone seated on a couch or bed to clap and turn lights on and off. A subtler example with which most are probably familiar is lighting in offices (or homes, as it were) that turns itself off after some amount of time or when nobody is detected in the room.

Generally speaking, the aim of home automation is to provide enhanced convenience, comfort, and perhaps security, with a sometimes ancillary goal of efficiency. It is nominally time saving to have lights turn on instead of walking around to turn them on, and it certainly appeals to anyone having a lazy day. From a security perspective, the ability to control lights remotely or have them turn on automatically is handy for creating the illusion that someone is at home when the house is unoccupied. And, having lights turn off in rooms not in use is certainly energy efficient, both in terms of cost and green concerns.

In reality, however, home automation promises to be and can be a whole lot more than this. I believe, personally, that the capabilities of home automation are limited only by our imaginations. But, I’ll get to see some of these later.

A Dream Deferred

In our society, we made some relative peace with the automation of all manner of processes. Computers, software and robots have obsoleted countless jobs while creating countless others. Having a land-line is starting to be considered passe, and sending “snail mail” is positively ancient. People don’t calculate square roots and cosines by hands, and the calculators that children use in school are really small computers that plot graphs and resolve equations. Why then, do we still turn lights on and off roughly the same way we did 100 years ago? And why then, does the notion of home automation evoke Rube-Goldbergian imagery in most people’s minds? Why is it that, like the flying car, the “home of the future” dried up in our collective consciousness like a raisin in the sun?

Home automation has long been one of those sci-fi things that never really materialized. I’ve read many accounts suggesting that it is over-engineering at its finest. Why spend a bunch of money on something that saves you the five seconds it takes to get up off the couch and toggle a switch? I’ve even brought up the subject and had it suggested to me that I was encouraging laziness – that the valuable exercise of toggling that rocker was the last line of defense between a tenuous grasp on health and a society where morbidly obese is the new thin.

Why It Has Yet to Really Catch On

I think there are a number of reasons that home automation has been slow in developing and capturing the world’s imagination. First off, unlike a killer app or the Sham-Wow, it requires multi-faceted expertise. Someone has to know enough EE to build the components, enough about home electricity to wire them up, enough about home improvement to complete any necessary carpentry tasks, and enough about programming to design and deploy the logic. Oh, and they probably have to be good with people as well, since these things aren’t going to install themselves. So, find me a person with all of these skills and an interest in putting them into what has historically been a non-starter, and you’ve got a major head start on the industry.

Another preventative factor is the current state of product offerings. Some years back, X10 emerged as a concept, allowing signals to be sent over home electricity, effectively allowing one appliance to send a message to another. Full of promise, this new technology took off to some degree, and stores eventually picked up (and, in most cases, later dropped) this line of products. As they proved too expensive and cumbersome for prime time, the outfits from which home automation hardware could be purchased took to the world of catalogs and infomercials (e.g. the aforementioned Clapper). This vibe still persists. A classy home automation site looks like a QVC catalog or Skymall, and a less classy one looks like some kind of MySpace nightmare potentially not safe for work (it is, don’t worry). This image is not lost on consumers that happen onto it – the whole industry feels like the “wave of the future” in the same way that the Chia Pet revolutionized gardening.

But, putting aside those respectively logistical and marketing concerns, there are some very bland business concerns such as price points and public interest/demand. In terms of the former, getting “classy”, non-DIY home automation has historically required hiring a contractor to wire everything up for very “classy”, non middle class prices. Basketball players and rock stars can have lights that dim when they say “computer, dim lights”, but you can’t. And, in terms of public interest, most people wonder if it really matters if they can turn off their lights from the couch, and they think of office bathroom auto-lights that turn out if you don’t wave your arms around every 30 seconds.

Getting Off On the Wrong Foot

Let’s forget all that. I don’t mean for the purposes of this article, but in general. The home automation movement is, I believe (and if I have anything to say about it) going to take off in earnest. Belkin and other non-catalog vendors are starting to take an interest. Green concerns are taking notice. The general public is slowly coming around. Pretty soon, things are going to perk up.

And, here’s why. It isn’t about turning your lights on from the couch. It’s about your home being intelligent and anticipating your needs the way your phone and computer do. It’s about pulling up into your driveway and having your home notice that you’ve arrived, unlocking the door, and turning on some lights for you. It’s about windows and doors that are smart enough to sound an alarm when they’re opened or broken. It’s about scheduling non-essential appliances to run at times of day when things are cheaper. It’s about heating and cooling your home not on a manual schedule, but on one that minimizes your monthly bill. It’s about a refridgerator that notices when you’re running low on eggs. It’s about getting an email or an alert on your phone when you’re due to change your furnace filter. It’s about walking from room to room listening to a Led Zeppelin song and having the music follow you wherever you go. It’s about keeping your pets off the counter even when you’re not home. It’s about putting an exciting new face on the thing that provides the most comfort and the most hours spent in life.

This deffered dream is going to exploded. But… in a good way. So, buckle up and get ready for a fun ride.

By

Adding a Menu Placeholder in WordPress

How-To

In a bit of a reversal, I’m going to cut right to the chase and post my solution, followed by the back-story for those interested. I’m posting it right at the top because this would have saved me an hour or so had I stumbled across it last night, and I’m hoping it helps someone else later. So, without further to-do (points to anyone who can name the movie reference), here’s how to create a placeholder menu item in WordPress, without using the control panel’s menus (i.e. just the default menuing used by your theme).

The basic idea is that I wanted a menu at the top that had sub-menus, but without the menu item itself being clickable. The default in my theme (as well as twentyten and twentyeleven) is to have pages with no parent as menu-items and pages assigned a parent as sub-menu items. This is perfect, except for the fact that every menu item is a page, meaning that adding a page as the placeholder menu item forces me to add a navigable, empty page, which is kind of low rent from a design/UX perspective.

Here’s my solution to the problem. I created a file called “gohome.php” and added it to my theme folder. The file’s contents are simply:


Now, with this added, when I create or edit a page from the built in wordpress menu, I see the following options for template:

So, the interesting thing here is that wordpress picks up a page theme from a file by parsing its content for the commented line. I pieced this together from some blog and forum posts that I read (described in more detail below) and learned only through trial and error/deduction that WordPress picks up the fact that this is a page theme from the comment containing “Template Name” and the display name.

All this actually does is redirect the user to the home page if he or she happens to click on the menu item. It is perhaps not the most elegant possible solution (I would say that it would be more elegant to have the link not clickable in the first place), but it’s better than directing people to an empty, useless page and I like it better than another solution I found which was redirecting them to the first child. If clicking the menu item was a miss-click when going for first child this makes sense, but if not, I think this would be confusing.

Another alternative that I put into place was goback.php:




This uses javascript to effectively redirect the user to the last page he or she was on, instead of home. The “php code” here feels kind of weird, since the PHP serves only to house the necessary comment, but it works. I have both page themes in my arsenal now so that I can adopt whatever implementation I see fit. I’m leaning toward the “Go Back” theme since that seems a little closer to the actual desired effect – I’d rather the user click result in nothing than the user click result in going home (which will be jarring if not initiated from home page) or, worse, going to an empty page.

This is ultimately a hack. After all, I’m still actually creating a wordpress page and all that goes with it just to get the menu item. However, the page is empty and it does nothing but route the user elsewhere. This is the magic behind the hack.

So, use in good health – I hope someone finds this helpful. It’s not the most elegant solution in the world, but it’s one that clearly works within the confines of WordPress and doesn’t require modification beyond adding things to the theme. I prefer adding to the theme rather than modifying it, and I prefer either of those to modifying WordPress source, and this requires only adding to the theme. Furthermore, it doesn’t require using the WordPress menu structure, the motivation for which I’ll cover below.

My Quest For Sanity

Up until recently, I’ve had no need for a menu item place holder, as the only menu/sub-menu situation I had was one where clicking on the main menu item made sense. However, I’m in the process of prototyping a new menu layout for daedtech locally and the need to have a simple place holder came up. So, the first thing I did was follow the built-in menu-by-page paradigm, and that left me with the empty page. I looked in the wordpress control panel for a way to make the page non-navigable but this functionality is (understandably) not supported. I then tried making the page private, but I tried this half-heartedly, figuring it wouldn’t work. It didn’t.

So, I alighted to google to see what I could find. The first thing of note I found was in a lot of places, such as here, here, and here. WordPress has a built-in, customizable menu functionality. Great – problem solved!

Not So Fast

I could see how most people had solved this problem, and I followed suit. I diligently created a menu from the control panel using the pages that had previously been auto-menued by the theme. This took a while, and the API was intuitive if a little slow and cumbersome, but I finally had my menu structure in place. I saved it and viewed it on the actual site and saw that I had made a few mistakes. So, I went back in and modified a couple of things and saved again… only to get an error 500. I reloaded the page and tried again. 500. I closed my browser and tried again. 500. I restarted apache and tried again. 500. I tried other browsers. Yup, you guessed it… 500. Apparently, the menu structure save operation was passing too many post variables or some such thing.

Alright, time to take a break. I went and got some water and then decided to go back to google again. I read a few pages like this one and saw that the WordPress menu feature works great until you have about 24 menu items. Then glitchiness starts. As you increase it, the glitchiness becomes more apparent until, at 70 or so, there is nothing but glitchiness. I was closer to 24 than 70, but this apparent complete lack of scalability did not bode well for my future plans.

The general consensus in defenders of what was going on seemed to be “why would you want more than 20 menu items?” I view this kind of response as a non-starter and, in fact, a conversation ender, so I decided that if this was the prevailing attitude, I’d chalk the menu system up as worthless and seek another solution. I have to say that (1) I use WordPress and for free (2) the people from WordPress that I saw commenting on it did explain that this was an ongoing technical challenge that they plan to address in future releases. So, I’m not complaining at all – just a dispassionate assessment of the situation.

Back to the Drawing Board

At this point, I figured I’d exhausted my options for using the WordPress GUI and I started looking at plugins. These are so numerous and searching for them can be sort of exhausting, so I gave up on that. After a fruitless half hour or so of poking around, I stumbled on this blog post, by Bruce Header. He had borrowed a solution from here and linked to it.

Now, I was really onto something! This wasn’t really the behavior that I wanted, but it gave me two important pieces of information: this is how the page templates get incorporated and it’s possible to use your themed page to do a redirect. So, from there, I mustered my own solution of redirecting to home out of my limited knowledge of the WordPress codebase. Then, I created the place holder page as an empty page and set it to this new “Go Home” theme. I was finally in business.

Tweaking

After I got this setup, I realized while using it that the redirect to home was great if you started at home, but seemed a little weird if you hadn’t started at home. So, I debated how I’d want to handle this and concluded that a conceptual refresh (i.e. redirecting to the previous page) would be best, or at least desirable enough that I ought to include a template for that as well. From there, the javascript was really trivial. So, leaving the page empty and using the “Go Back” template creates a situation where the user navigates from X to Y, and Y simply deposits them right back at X. Short of eliminating all clickability, this is probably the best solution.

In the interest of non-clickability, this is the most promising thing I’ve found so far. However, it appears only to be for making the menu items non-clickable if you use the WordPress custom menu scheme and set the placeholder links to “#”. This isn’t actually possible when using pages, so the solution would require some modification here. I have no doubt that this is doable, but I don’t know if this rates high enough on my list at the moment to go poking through the theme and WordPress PHP until I can figure out how to do this. If I have some downtime, it might be interesting, and I’ll make another post about it if I do.

By

Stop Online Piracy Act (SOPA): History Repetition for the Doomed

What is SOPA?

For anyone not familiar with the Stop Online Piracy (SOPA) act, a brief primer on it can be found on wikipedia. It is an act being considered by the United States Congress that would allow websites accused (not found guilty of, but accused) of engaging in piracy, promoting piracy, or simply creating an environment where piracy could theoretically take place from being blacklisted in DNS. For those not familiar with DNS, it is the ubiquitous service that takes a 12 number IP address and resolves it to a pretty URL like https://daedtech.com. Under SOPA, if someone accused daedtech of supporting piracy, typing the URL into your browser would stop working, searching for it on google would stop working, and pretty much everything about the site would stop working. Daedtech would be guilty until proven innocent.

The bill is driven by intentions that are reasonable (but obsolete, as I’ll argue later) — to protect intellectual property. It’s aimed at stopping someone from bootlegging movies or music and setting up a website to share the plunder with legions of would-be pirates. But the approach that they’re taking is a bit like cutting off your leg to address a splinter in your pinky toe. I say this because “guilty until proven innocent” tends to result in paradigms more like the Salem Witch Trials and McCarthyism than it does in reasoned, judicious use of preventative force. In the current system, people are on their honor not to be criminals, which is how most of society works. With a “guilty until proven innocent” system, the system is on its honor not to abuse its power, which is how scenarios like that in 1984 get started. I submit that the only thing less trustworthy than John Q Public to be on his honor is The Prince being trusted on his honor. But, I digress.

The end result is that the internet as a boundless repository for all manner of ideas, big and weird, all forms of collaboration, and all kinds of expression, from the disgusting to the divine, would be fundamentally altered, at least in the short term. It would cease to be a sometimes scary, under-policed realm and would, instead, become a “walled garden”. And the walls would be manned by corporations like the RIAA, MPAA, large software companies, and generally speaking, armies and armies of lawyers. Nevermind that none of these organizations save the software companies are particularly expert in the workings of the internet or technology – that isn’t the point. The point is to make sure that the internet is a place for free expression… so long as that expression doesn’t interfere with certain revenue streams. This is entirely rational (I sympathize with any entity protecting its own bottom line) on the part of the would-be police, but to call it a gutshot to the spirit of the internet would be an understatement.

How did it Come to This?

I’ll get to that in a moment, but first, let’s consider a term that most people have probably heard once or twice: Luddite. In most contexts, people use this to describe those afraid of and/or suspicious of new technology. So, it may describe a friend of yours that refuses to buy a cell phone and bemoans that people constantly use them. Or, it may describe a relative who has been writing letters all his life and isn’t about to stop now for some kind of “email fad”. But, the term Luddite arises from a very real historic scenario, with a subtlety different and richer message.

In the late 1700’s and early 1800’s the French Revolution and ensuing Napoleonic Wars set the stage for rough economic times by virtue of Europe-wide destruction and devastation. Add to this an Industrial Revolution in full swing, replacing individual artisans with machines, and you had a perfect storm for unhappy laborers. A group of increasingly displaced, unskilled textile workers weren’t going to take their obsolescence lying down – they organized into a paramilitary group and executed a sustained, well organized temper tantrum in which they destroyed machines like looms and mills that were replacing and obviating their manual labor.

This went on for a few years, and has the kind of ending that only a Bond villain could love. The British government smashed the movement, executed key participants, and progress marched on, as it inevitably does. This is indeed a story with no real hero. Instead of adapting or undertaking a campaign of ideas, a group of people attempted futilely to “stop the motor of the world”, and, in response, another group of people broke their spines. The theme of 2 potentially sympathetic interests acting in a way to render their plights completely unsympathetic via collateral damage is worth noting.

Ludditism Through the Years

The Luddites gave a name to an age old phenomenon (albeit one that is seen more often as the pace of technological advancement increases): man fighting in vain against his own obsolescence. Here’s an interesting look at the way that this can affect just one particular industry:

  1. Late 1800’s: Composers worry that the phonograph, which allows songs to be recorded in short bursts, will obsolete the musical performance and the performance of long elaborate symphony
  2. Early 1900’s: Record (phonograph “cylinder” producers) worry that the advent of radio will destroy their livelihood
  3. Mid 1900’s: Radio industry worries that the advent of television will destroy their business
  4. 1980’s: Record labels worry that the tape, which allows home recording, will devastate their business
  5. 1990’s: Record labels worry that the CD burner will devastate their business
  6. 2000’s: Record labels worry that the internet and streaming will devastate their business

Now for the most part, these concerns and others like them were “Luddite” in the common, vernacular, anti-technology sense, rather than in the scorched Earth sense of the actual Luddite movement. The cycle is predictable and repeatable – new thing comes out, current top dog is worried. Sometimes current top dog adjusts and adapts (radio), and some times he dies out (phonograph, cassette tape). But whatever happens to top dog, progress marches inexorably onward.

Adapting By Anachronism

In the list above, you’ll notice a constant over the last 30 years – the RIAA is afraid of and upset about everything that happens. Previously, the cycle involved some new medium replacing or gaining foothold beside an existing one. And, that continued through the entire list, but the only outlier is that the same entity is now afraid of everything that happens. Why is this…?

I would argue that it’s because record labels themselves are anachronistic throwbacks that exist only because of previous power and influence. They are exclusively in the business of keeping themselves in business via influence peddling and manipulation, providing no relevant product or service. Let’s consider the history of music. For basically all of recorded history until very recently, musicians were exclusively performance artists, like jugglers or an acting troupe. They sold services, not consumable goods. Wandering minstrels, court composers, and random people with good voices played for whoever, royalty, and friends/family, respectively. Musicians occupied a place in society that ranged from plebian to whatever equivalent for “professional” or “middle class” existed at that place in history.

This all changed when the invention of recorded music turned music into a commodity good rather than a service. At first, the change was subtle, but as music changed from something people had to make for themselves or their neighbors to a specialized good, a dramatic new paradigm emerged. Companies realized that they could leverage economies of scale to bring the same music into every living room in America or even the world, and they subsequently realized the star power that came with doing such a thing. Court Composers like Mozart had nothing on Elvis Presley. The upper crust had to go to see the famous Mozart perform, if they could get a ticket, but anyone with a dollar could enjoy The King (title very appropos here). Record labels went from selling vinyl discs with music on them to selling dreams, and musicians went from travelling charlatans, court employees, or volunteer music lovers to Kings (Elvis Presley) and Gods (Beatles being “more popular than Jesus”) overnight, in a historical context.

With this paradigm shift, the makers of music had unprecedented power and influence via money and widespread message, and the facilitators of this, record labels, had control over that message and influence. It was the golden age of music as a commodity, where its participants were kings and kingmakers, and the audience served as their subjects. All of this was made possible by economies of scale. Not just anyone had the ability to record music and distribute it nationally or internationally. That required expensive equipment, connections, and marketing prowess. The kings were beholden to the kingmakers to anoint them and grant them stardom. The subjects were beholden to the kingmakers to bring them their kings, what with the everyman musician being a casualty to this form of specialized labor (meaning the days where someone in every family could play a mean piano were now obsolete since music could be purchased for a buck an album).

But then a funny thing started to happen. The everyman musician started to make a comeback, not only for the love of the music, but also for the lottery-dream of being anointed as a king. Generations of children grew up listening to Elvis, The Beatles, Led Zeppelin, Michael Jackson, etc, and wanting the lifestyle of untold riches and adulation. Home music making equipment proliferated and improved and rendered the studio a luxury rather than a necessity. The internet exploded onto the scene and suddenly distribution channels were irrelevant. Sites like youtube and twitter emerged in “web 2.0” and now even marketing was available to the masses. Every service provided by the kingmakers when they were making kings was now available to the unswashed, plebian masses. Music is very much coming full circle, back to the point where heavily marketed, auto-tuned pop stars who play no instrument are unnecessary and the average person, with a computer, an instrument or his or her vocals, is perfectly capable of producing and sharing music. And, that situation is back with a vengeance since that person is now also capable of sharing that music with the world. Untold riches, record executives, destroyed hotel rooms and temper tantrums aren’t necessary – just an internet connection and an idea.

The only thing that the kingmakers have left as this point is the accumulated money, power and influence from bygone glory days. They are obsolete. And, like anyone concerned about his own obsolescence, they have entered the camps of the Luddites. At first, it was the vernacular ludditism – whining vociferously about new technology dooming them, spreading FUD about the technology, etc. But now, to tie it all back to SOPA, they are taking the step of being actual, Scorched Earth Luddites. SOPA isn’t actually about stopping piracy. It’s about destroying the thing that has removed their authority to make kings – the thing that has revealed them as unnecessary, out of touch emperors wearing no clothes. SOPA isn’t about fairness – it’s about breaking into the metaphorical mill and taking a sledge hammer to the metaphorical loom. It’s about destroying the thing that is replacing them: the internet.

The music industry is perhaps the most obvious example, but this applies other places as well, in that the internet’s very distributed, collaborative nature has created a cabal of outfits that wish the internet would go away. Book publishers (again, distribution economies of scale), older gaming companies, the movie industry, etc are all in relatively similar boats where instant, massive collaboration is replacing their purpose for existing.

Vindictive and Scary, but Doomed to Failure

There is one key difference with today’s Luddites versus the original ones. The original ones were opposed by their government and eventually smashed by it. Today’s Luddites are using lobbyist influence in an attempt to purchase the government and use it to execute the destruction of the looms. Instead of oppositional forces, the government and the Luddites are threatening to team up to unleash destruction. But in the end, it doesn’t matter. Government or not, Luddites or not, progress marches onward inexorably.

We as techies and most people as the consuming republic will gnash our teeth and (rightly so) do everything we can to prevent the destruction of the Luddites, but we may ultimately fail to stop them in a specific equipment smashing. But, what they can’t smash is the fact that the technology has been discovered and used and can be re-created, modified, adapted and perfected. At some point, their sledgehammers will dull, their resolve will weaken, and they’ll be relegated to the dustbin of history.