How Much Is Too Much?: The Quality Balancing Act
Over the last few days I've been studying Lua in order to start developing some AddOn ideas for World of Warcraft. Lua is a very lightweight OO language used for embedding in other software to provide scripting and customization features.
A feature of Lua called "varargs" caught my eye. In a nutshell, it allows you to define a function with a variable number of arguments. This is similar to C# or Java, however in those languages you pass in arguments to the main method via a strongly typed array (ie String[] args). Before the "..." or varargs operator, you can pass in any number of named arguments that must be passed to the function. It looks like this: What's this? A super loosely typed language that has the gall, the unmitigated lunacy to allow completely random and optional arguments instead of relying on that old cornerstone of OO thought, overloading? That was my initial reaction. But after a while, I started thinking about the possible reasons behind a feature like this and why it actually was a correct design. It started with my friend making the following observation. As analytical thinkers, programmers value accuracy and perfection above all else. We are obsessed over the perfect algorithm, the perfect design. We want our software to be accurate to the hundred trillionth and have a rock solid design that will be robust yet flexible. However, in this quest for perfection, we sometimes lose sight of what's important: getting the job done. While quality is important in all things, it's equally important to meet the needs of the user. At my previous job after a merger, we adopted PHP as the official development language after years on Classic ASP. As a .NET developer, I was aghast at some of the fast and loose liberties our new coworkers took with web development and the loosely typed features of the language. During a discussion over the merits of strong typing someone said, "Sure, strongly typing's great if you're working for Mission Control". For a while I was puzzled, didn't these folks want to make the most robust, rock solid software? Well yes, to a point. The fact that I overlooked was that web development is more about new features faster. In an e-Commerce system, it's important to be correct, but money only goes to two decimal places. What language can't do that accurately? More recently, I worked on a small port of a URL shortener that I call Chorty. Trying to come up with a way to create a random 4 character identifier was a bit of a challenge. I wanted to make the system never run out of possible combinations ever. The computer scientist in me was taking over. Eventually though I realized two things: 1) This is not going to be the next TinyURL.2) Knowing #1, I think nearly two million possible combinations is perfectly fine.In fact, all one would have to do to expand the possible combinations is increase the length by a character or two. And this is extremely easy to do in the code, so problem solved. We don't like to admit to ourselves that our software will never be perfect, but that's the truth. We will always have to revisit code and sometimes good enough is perfectly OK. In the case of Lua, the obvious intention isn't to create a rock solid language that can launch a rocket into space. The design of Lua is intended to provide a very fast, very flexible language for rapid scripting. I don't think my World of Warcraft AddOn needs accuracy to the hundred trillionth. As developers, we need to know when our software performs reasonably enough to fit the problem at hand and leave it at that.



