Archive for the ‘Rants’ Category

Software Complexity

Friday, December 14th, 2007

If you’re not a developer, this rant might not apply… (although there’s probably parallels in every discipline)

The “hard” stuff is easy. The “easy” stuff is hard.

It’s difficult to give a concrete example of this without going annoyingly deep into details, but I’ll try to capture the gist of what I mean with a made-up example: Let’s say you have a web site and you want the entire site’s look (logo image, background colors, highlights, etc) to change and reflect the season (Christmas, for example). If you think about this at the surface without knowing the technology (such as a manager or boss might), it seems like a huge, complex task. If you’re not privy to the knowledge of how things work, you’d likely assume that doing such a massive change could involve edits to hundreds or thousands of files! Daunting! (Which in manager-speak translates to: Expensive! Which means some web designers end up making a lot more than programmers do per hour.) And yet, this is actually quite easy stuff assuming you’ve done your CSS/HTML properly. Just a few changes to one or two files, some new artwork graphics, and you’re good to go - the entire site has been updated!

Ultra-simplistic example:

old CSS:
#header-logo { background: src(/img/logo.png) }
#header-title { color: black; background: white }

new CSS:
#header-logo { background: src(/img/xmas-logo.png) }
#header-title { color: red; background: green }

Just sit and think about that for a moment… a few changes and this potentially HUGE website got an entirely new look for the holidays. Every single page is changed. Wow!

So if something so “hard” as changing every page on the entire site is that straightforward, why not just change how the input box accepts input real quick, too? How about getting rid of the text box for “birthday” and putting in a day/month/year box with drop downs for each value? That can’t be too hard, right?

No, that sort of thing is not terribly difficult in the grand scheme of things, but compared to tweaking a few styles in CSS it is likely many orders of magnitude more time consuming and potentially error-prone. Why is that? It doesn’t make sense! It’s a small, localized thing - only visible in one input box. How hard can it be?!? Why does it take so long? What’s the big deal?!?

Well, there’s a ton of things that could potentially need to be changed just because of this “easy” modification. The number of changes that the developer makes is inversely proportional to the elegance, clarity, maintainability, and cleanliness of the resulting code. This birthday example is sort of simple, but maybe it can illuminate how a larger “simple” feature can result in a developer going totally insane as complexity ripples throughout the program…

Ok, so we’re changing the birthday field on an input form from a simple text box to three individual boxes. This means that the user-entered data now needs to be gathered from not one place, but three. This means the amount of code required just to get the raw data has trebled. Sure, in this case you’re talking about 3 whole lines - big deal, right? Well, in addition to those three lines, the final date would need to be rebuilt from the component parts and validated as a legal date (unless you want bad data in your database). So there’s more code to combine all the discrete parts back together. On top of that, the old input box was empty and this new input system requires pre-populating the drop down menus with numbers and month names and years - so that’s even more code that’s either hardcoded in the HTML itself or added as yet another condition that gets activated on page load or whatever.

Previously code might have looked like this (in a fake language I made up just now):

onPageLoad:
... nothing extra ...

onFormSubmit:
birthday = Date.dateFromString( Form.birthday );

And it has been transformed into this:

onPageLoad:
Form.birthdayDay.selectOneOf( 1 .. 31 );
Form.birthdayMonth.selectOneOf( Jan, Feb, ... etc.. );
Form.birthdayYear.selectOneOf( 1900 .. Date.currentYear );

onFormSubmit:
birthday = Date.new;
birthday.setDay( Form.birthdayDay );
birthday.setMonth( Form.birthdayMonth );
birthday.setYear( Form.birthdayYear );

Or something like that… (Note, I’m not cheating with the previous code that calls something named “dateFromString” as many common libraries have functions that do exactly that and will parse all sorts of user-generated date format strings.)

This example doesn’t even account for the fact that the HTML of the page probably had to change to accommodate the new drop downs, which means that the structure of the CSS may have changed a little bit, too, and possibly caused a headache for the web designer! On top of all that, my made up example language would actually be a welcome change to the insanity that it can take to do some of these things in some real-world UI frameworks (for the web or otherwise) which means in real life you’re probably looking at even more lines of code to manage everything. All for this so-called “easy” change!

I know this is a somewhat convoluted example, but I hope somehow my point has been made. :-)

Whew. I wish I felt better… sadly, though, I have to go back to working on “easy” stuff that’s taking way, WAY too long. *sigh*

Warning: Rants Ahead

Thursday, November 8th, 2007

It’s rant time, people!

#1: Have any of you ever heard the phrase “Don’t look a gift horse in the mouth?” I think you need to study up and figure out what that means and how it applies to me and iApp-a-Day - it’s wise advice…

#2: This next issue is more important. Ste (world-famous iPhone package maintainer extraordinaire) has apparently been getting some nasty emails from folks about hosting Mobile Holy Quran. Seriously?

First of all, I wrote the software for Zoosware and I happen to think it’s some pretty sweet stuff, technically. No, I’m not a Muslim. And yes, I am American/Christian. Shocked? Some people apparently are.

The shock goes both ways: I’ve been told that Muslims are often stunned to find out that a non-Muslim American wrote it and it impresses many of them. You see, their world is filled with the same misconceptions about ours as ours is with misconceptions about theirs. Interesting, isn’t it? There’s people on both sides of this divide that feel they are superior or more “right” than the others - and the truth is that neither set of extremists represents the vast majority of normal people stuck in the middle.

Extremists keep people apart. Extremists are against open communication. Extremists would rather believe their own specific fiction than know a real truth. Christian extremists, Muslim extremists, nationalistic extremists, racial extremists, etc. All are guilty of driving people apart.

Interestingly, I do believe that extremists have their place in society. We need them - but their usefulness as a whole is limited and not perpetual. Extremists help shake things up and cause the masses to question long-held (and often incorrect) assumptions. This is good for everyone and when we come back together again, we grow as a species and as a culture - but it is not healthy to maintain an extremism in the same way that it is not healthy to drink soda and eat potato chips for every meal. Moderation is important to maintaining health mentally, physically, and spiritually.

I believe that the time for religious extremism is globally coming to a close. The world is much smaller than it used to be. It’s far easier to communicate. The normal people that the extremists have been trying in vain to “protect” from each other on each side are starting to find ways to come together, meet, understand, and accept one another for who they are as individuals. It’s a slow process, for sure, but I think it proves a fundamental point about humanity: we need each other and there’s some underlying force of nature that constantly strives to bring us back together after a rift develops. That force goes by many names - but in my opinion, the name is just an attempt to make concrete something which is, presently, very mysterious and unknowable about life.

Think about it… It was not so long ago that the world was caught up in war. There was so much hate and mistrust that the US eventually dropped the mother of all bombs on Japan. And where are we now? Japan and the US have great relations. Most of Europe gets along quite well now - perhaps better than they ever have before. Only a few decades ago the hate being thrown at Muslims by some in my country was being directed to the Japanese, or the Germans, or the Italians, or the Russians and they thought and believed that it would always be that way and that it would always be socially acceptable to hate another culture.

They were wrong then.

They are wrong now.

Cryptscriptions

Friday, November 2nd, 2007

I’ve been getting blog comments as well as emails like this:

You need to be more descriptive about what each app does so I don’t have to come to the blog or google around for details.

Generally, I have not been responding to those emails because I didn’t quite know what to say and they were a small minority of the messages I’ve been receiving. However, it’s only the second day and it seems to be becoming a trend, so to all who may have sent me mail or posted blog comments about this, I say the following:

…you could just try it and find out yourself what it does, yes? You don’t have to come here to check and leave an angry comment or email - that probably takes longer than just clicking the “Install” button.

Part of the goal of iApp-a-Day is to bring a small bit of excitement and mystery into people’s lives each day (as well as mine). I’m not going to list a roadmap of what is to come for the same reasons that I don’t intend to meticulously detail what each release does unless it’s somehow important for that application.

Is it really so critical to know exactly what it does ahead of time? What if it does almost nothing? In the case of today’s “Fall” the package description says “It’s fall - get the leaves off the tree!” Those of you who have downloaded it know that’s all there is to it. It’s a toy - nothing more. What else is there to say about it? I’m writing an app-a-day here… not an office-suite-a-day or an operating-system-a-day. In fact, I’m not even writing “applications” - just “apps.” They’re so small that even using such a long word seemed like overkill and it had to be shortened! :-)

Loosen up. Have fun with it - I know I am. If it wasn’t fun for me, I’d never have a chance of finishing this quest and then you guys wouldn’t have any new apps to look forward to each day. (Well, not from me, anyway.) Sit back, relax, knock some leaves off a tree while sipping a cup of hot cocoa, and remind yourself what it was like to be a kid again.

PSA: Backup your stuff.

Thursday, October 4th, 2007

Last night Melody’s laptop hard drive decided to die a horrible, click-filled death. As it became apparent things were going downhill suddenly, we acted fast and managed to pull off a handful of files before it failed completely. Unfortunately by handful I mean like maybe 200MB of stuff which did NOT include bookmarks, sticky notes, years of emails, photos, and tons of other stuff that wasn’t backed up.

What really sucks is that I had been playing with Leopard using the partition I had used to back up her laptop in the past and was going to re-backup her computer and trash the Leopard beta just last night before we went to bed - about an hour before the drive suddenly died. So, basically, I could have prevented or at least minimized the whole thing if I hadn’t decided it would be fun to mess with Leopard briefly. Wonderful. The only thing that makes me feel slightly better about that situation was that the backup I had overwritten was really really old. At least several months - if not longer. Of course it would have been better than nothing and a lot of the older stuff is the stuff she really would liked to have kept anyway. *sigh*

So today I’ve managed to recover all the music that was on her iPod using a nice tool called Senuti - but so far I haven’t got her photos from it and I’m not sure it’s worth it. iTunes resizes the photos for the iPod anyway and so they’d be tiny thumbnails in the end. *sigh*

Later today I’ll call Apple and hope that buying Apple Care pays off in the form of a new hard drive, at least…

Ironically, we have been preparing for the release of Leopard and Time Machine by buying a new Airport that supports attaching a hard drive and planning to buy a RAID array to attach to the airport so that we could set up Time Machine on each of our laptops to use that drive as a backup volume so we’d have automatic and safe backups… *sigh*