A Bit of Software

My wife loves Stargate fanfiction, but would like to be rid of the foul language. I had created a few shell scripts (that used bash and awk in unision with a flat-text file containing regular expressions), but she soon found these too arcane to use. Problems crept up that I had never had before and I haven’t been able to reproduce. What to do, what to do? Well, I sat down and wrote her a brand new version in pure C# (not that she cares), with a pretty GUI (well almost; I hate the way the widgets run to the sides, but I have not yet taken the time to fix it), that access an SQLite database.

I am now releasing this auspicious software under the name of Swearinary 0.1 to the public under the Mozilla Public License (MPL) v. 1.1. No doubt you will soon
read about updates to this selfsame software. If you’re interested, pop on over to the projects section and grab the tarball.

Elegance

Elegance — that one mystical property that all geeks hold dear to their hearts. Whether we are programmers, computer scientists, mathematicians, or physicists, we all value elegance. In fact, it can be said that it is this appreciation that separates the true geeks from the interested by stander or tradesman. It goes beyond a simple curiosity to a true appreciation for an innate beauty that the outsider cannot understand.

Fine, that is all nice and good, but what is elegance? I mean really. We can look at things (programs, theories, solutions, etc.) and say whether they are or are not elegant, but what is the litmus test? The first one to chime in that it is entirely subjective gets whacked on the head with the planet Neptune. Elegance is not in the eye of the beholder. Elegance is the ability to boil the entire solution down to one unifying idea that holds throughout the whole. By extension this means that the fewer special cases are involved, the better. The perfectly elegant solution wouldn’t even have to handle special cases–they would all be taken into account automatically. Of course, we seldom get that far, but that is the goal. Yet one last way of stating it is, the closer you’ve come to completely satisfying Occam’s Razor, the more elegant your solution is. Don’t believe me? Let’s take some examples.

Particle physics is about as inelegant a solution as one could ask for. Sure, it works (in fact, it was the best experimental track record in modern science), but physicists are increasingly dissatisfied with it because it is inelegant. Let’s take a closer look.

Calculus. Now Calculus IS elegant. No whining stories about how hard it was to learn or whatnot, it IS elegant. The finest example of just how elegant it was, for me personally, was in Physics II during my last undergrad semester, when we started doing Gaussian surfaces. The professor showed us two ways to handle the problem, with a convoluted algebraic formula that we could memorize, or a couple of integral equations that we could memorize and use to derive the equation needed for the problem at hand. The second method won hands down. What about what I said earlier? Can Calculus be boiled down to one essential idea? Yes, it can. It is the idea behind the limit and, consequently, behind the derivative and integral as well: it is the idea of breaking some potentially horrifically complex surface/line/whatever down into infinitesimally small pieces which are relatively easy to compute, and summing them up to get an estimation for the answer. In theory, if we could sum a truly infinite number of these little deltas, we would get the One True Solution. In practice, the error is so small we take the answer to be correct.

So why is it important? Is it a mere aesthetic pleasure? No, I would argue not. I would argue that it because elegance is tied to simplicity, that elegant code is better, more maintainable code. Notice here that there is a big difference between “clever” code and “elegant” code. Most clever code is not in the least bit elegant. Very often, “clever” code relies on a non-obvious complex property of the system to make itself work, thereby making it harder to understand what it is doing, how, and why.

A Day at the Opera

I have had a spurt of web programming and web design work as of late. Along with a fresh new openSUSE install, this has driven me to give Opera 9 a try. I’ve been using it as my primary browser for a couple of weeks now leading me to decide to pen a few words on this venerable piece of software.

Opera is the Apple of web browsers. It is probably the prettiest browser you can use. I personally love the way it renders. Everything is very smooth, particularly the fonts. It isn’t even something I can really put my finger on, so much as it is just the general experience. Also like Apple, Opera is an “all-in-one”, no configuration, relatively little customization. If you like it? Great. If you don’t, tough. The package IS the product. From Bittorrents, to adblockers, just about everything you would normally download an extension for in Firefox comes packaged right into Opera. Whether you consider this good or bad is an entirely subjective matter.

On the whole, I find Opera to be pretty much on par with Firefox. There were a few things that I did like better. Not really technical issues, just preferences. I liked the way Opera automatically alphabetizes the bookmark listings. I keep a lot of bookmarks (which makes the Opera/Firefox/Netscape parlance of bookmark more accurate for me than that of Internet Explorer), so this makes it a lot easier to dig up older resources. As crazy as this sounds, another thing I liked were the JavaScript errors, which mattered because, as I said, I was developing a web app.

I did have only complaint: Opera crashed on me–a lot. Programs crash, it, to some degree, is a way of life. Nothing is perfect and, sometimes, it really is safer just to die, but Opera has given me more random crashes than I care to think about. At least session saving worked well.

In conclusion, draw your own. These are my experiences. Download Opera and tell me yours!