Oct 26, 2009

Are 2-Digit Years Due For A Comeback?

The problem Y2K embodied was that years were being stored as 2 digits on many software systems. 1999 was abbreviated as 99. When the year flipped to 2000, many were not sure what would happen with their computer systems. As a result, many dates were changed to 4-digits, or systems were re-architected to handle the transition in other ways.

People who were in the IT industry in the year 2000 know that Y2K was a significant problem. The fact that it did not materialize to much of anything was due to our diligence and the solutions put in place.

Now that we're approaching 2010 and double digits can once more be used to designate the year in a reasonably clear fashion, is it safe for new projects to utilize double digit years?

Storage Space

The main reason years were stored as two digits was that they took up less storage space. Space is cheap nowadays, so this is a far less compelling argument. However, for the rare date-oriented embedded or mobile app, or enormously large databases with many date fields, this may still be a valid consideration.

Y2.1K Is A Looong Way Off

The year 2100 would effectively be another Y2K for any system that utilized 2-digit years. But considering how fast technology changes, I can't imagine any data created now persisting for 90 years. Who knows what the face of technology will be then? Maybe we'll be storing our data in laser-stimulated protein chains by then.

Looking at it from the other side, some programs that were problematic during Y2K were 30+ years old and still in use, and it was somewhat difficult to find enough skilled mainframe programmers to repair them. If you develop a system in the year 2050, who's to say it won't be in use 50 years later?

Reduced Internet Traffic

There is a recent movement for URL-shortening. Shorter URLs mean very high traffic sites can save huge amounts of bandwidth by not having to transmit full URLs in HTTP headers or in content pages. Using 2-digit dates would reduce some overall internet traffic.

Downgrading Risk

If your current system utilizes 4-digit dates, it is doubtful that you have a compelling reason to re-architect your system to use 2-digit dates. Such a move would be costly and perhaps completely unworkable.

Compatibility

Many libraries (if not most) use a 4-digit year. If you switched to 2-digits, you may have to upconvert in your code to utilize those libraries, or create custom libraries, creating another point of failure for your software. If you use date math heavily, a 2-digit date is probably not for you.

Repeating Mistakes Of The Past

Whether or not there are compelling arguments for either side of the discussion, there is always the nebulous "we did it before and look what happened" factor to consider. Generally speaking, abbreviating data that does not need to be abbreviated is rarely a good idea.

Conclusion

In general it is probably a poor idea to utilze 2-digit years. However it is possible that there may be rare valid applications for its use, but even that should probably be limited to greenfield projects.

I have not seen this topic elsewhere so I thought it may make for some interesting discussion. What do you think?

Oct 9, 2009

Programming Doesn't Always Require Math

This is a response to a recent blog post which poses the question "Do we need to know basic math as programmers?" The author seems to think little of those who have weak math skills. Based on the comments, it would seem many others agree. I appear to be one of the few dissenters, so I will voice my opinion here where I can expand on my reasoning more fully.

The author uses a "basic math" example of flipping the sign of a number. So -5 would become 5, and 5 would become -5. The author's solutions are good, suggesting either to multiply by -1 or to create a function which returns the negative of the parameter (my preference, as it avoids the use of a "magic number"). Some other solutions are presented, some of which were likely jokingly submitted by the respective author, and others perhaps not.

I'll be honest. Math is not my strong suit. When the question was first posed by the author, I had to think about the solution. This lead me to ask myself why I had trouble with this question when so many other people seem to believe the answer should be instantly obvious to anyone with two halves of a brain to rub together.

So I started to wonder - does this scenario even qualify as basic math? It would seem to be more of a factoid principle that is used in practice very rarely. How often would this scenario occur in day to day programming? When was the last time anyone had to perform this task in a real world environment? How often was this task put into practice by most people after it was initially learned? I would think fairly rarely. I can't remember ever doing it. As with all things, a lack of use will breed forgetfulness.

But I digress. Let's tackle the question head on: do all programmers need to know basic math? As per just about every other blanket statement ever uttered, the answer is not an unequivocle yes. My answer actually leans towards the middle, if not no.

I work as a web programmer. I write back end (and some front end) code for a fairly heavily trafficked website. Most of what I do revolves around data: displaying, querying, storing, modifying, etc. How much "basic math" do I need for my job? Unless we include the odd time I calculate widths for CSS properties or manipulate substrings using raw addition and subtraction, the answer is pretty much nil.

There are many websites like mine who's major functions consist of managing users and storing and displaying data. I would assume most of them get along fine with few applications of mathematics as well. I am also fairly confident that many other application categories - to do lists, day planners, system tools, reporting applications, basic control software - do not require much in the way of mathematics either.

Obviously there are a huge number of important and direct applications for mathematics within computer science. After all, if there weren't, math courses wouldn't be featured so prominently in related educational programs. Scientific computing, technical applications, modeling, advanced control software, and more, are all very math intensive. Those of us not blessed with an abundance of mathematical ability would be advised to steer clear of such problem domains. However even within those domains the entire programming team does not have to understand all, or perhaps any, of the mathematics involved. Often there is plenty of room for specialists in other areas - database, clients/server, GUI, etc - within those applications.

Years ago pundits were extolling the virtues of the widget. They theorized that one day business analysts would be able to manipulate widgets to create programs of their own, and that programmers could become a dying breed. While those days are certainly not yet here (and in my opinion will not likely arrive in my lifetime), there is something to be said about the ever-growing level of abstraction we are presented.

It wasn't all that long ago that most programmers used assembly code. I wouldn't be surprised if many younger programmers never do so. I think we can all agree that the vast majority of programmers would never consider writing a major application using nothing but assembly language. We have been spoiled by increasing levels of abstraction.

But this abstraction can be applied to mathematics as well. Just as the "+" operator is an abstraction for the assembly code lurking behind executing that operation, higher level functions can be abstracted as well. In Java, I can use the Math library to perform trigonometry. Even if I were to write an application that involved heavy mathematics, given the right tool set, I may never need to know much about the math involved.

Don't get me wrong. Math is valuable. I envy those of you who excel at it. People like me will rely on people like you to perform - or abstract away - our heavy numerical lifting. But as time goes on and libraries and programming languages abstract away more and more of the lower level programming tasks, as a group, our need to know basic math may diminish.

IE 6: The End Is Nigh

Ahh Internet Explorer 6. Non-standards compliant. Unsecure. Unreliable. A web designer's arch enemy and a support person's nightmare. There aren't many insults one could hurl at it that it hasn't heard before. Yet still it stands tall, perched atop a hill, high above the rotting carcasses of technically superior and more cosmetically appealing and functional browsers.

In reality, the carcasses aren't quite so rotting, and that hill is shrinking rapidly. This topic has been discussed to death across the interwebs, so I will attempt to gloss over as much rhetoric as possible and show you why the proverbial light at the end of the tunnel is glowing brighter by the day.

Who's To Blame?

Why is IE 6 still popular? Ok, "popular" is pushing it and likely to make some people's head explode, so let's rephrase that as "still in such widespread use".

Designers? Some claim that if designers stop supporting IE6 then users will be forced to upgrade. This simply isn't true. There are too few websites powerful enough with sufficiently unique content to force users to upgrade. People will not upgrade, they will simply move to one of the 10 other websites that do the exact same thing as yours (but which do support IE6). The decision is a business decision, and as such, many designers have little power to influence the outcome. If this was not the case, IE6 would have been laid to rest years ago.

Businesses? There are web apps integral to company processes that require IE 6. (For example, the company I work for was unable to upgrade to IE7 until 4th quarter last year. It took that long for our team to find a window to upgrade our website content management system to a version that supported IE7.) Until those applications are updated, some companies simply do not have a choice. If your visitors tend to browse while at work (which *ahem* none of us should be doing...), dropping IE6 support could be a significant blow.

Users? This is where I believe the true problem lies. Most people who use computers simply don't know enough about them to know other options exist. Or they simply don't care. IE6 is built in to their operating system, so that is what they use. "Good enough" is a mantra most people ohm to. I'm sure there are many people with Windows Update turned off and don't even realize an upgrade is available. Those botnet agents have to be on someone's PC after all.

Licensing? Due to Windows Genuine Advantage, IE6 is the last version of Internet Explorer that people with pirated copies of IE6 can use. They would have to figure out how to bypass the security check to upgrade to IE7 or IE8. Many people likely wouldn't bother. Regretably, there are a lot of pirated copies of XP out there. Honestly, I doubt this aspect of the problem has much of an overall effect.

The End Is Nigh

IE6 is on its deathbed, and the spectre of death clutches at its web-designer-spit-covered remains. Many will claim credit for it (just Google "IE6 sucks"), but the truth is, it will have died a peaceful death due to natural causes.

Word Of Mouth Eventually the most recluse shut-in will have a friend or family member who notifies them that there are other alternatives available. Or they will stumble on alternatives accidentally. Many people likely don't care to exercise those options (see the "Good Enough" mantra above), but those who do will slowly add to the conversion rate.

Google I currently use Google Chrome as my main browser. I am in the minority, but that minority is growing. Chrome has already overtaken Opera's market share and is gaining on Safari. Thus far Google hasn't marketed their browser and you have to dig around just to find a link to download it, but if they decide to really push it, and if it is the default browser on the upcoming Google OS as I expect it to be, its share will grow substantially.

Apple iPhone popularity continues to push Safari numbers higher. It has also somewhat recently (as of version 3) been made available for Windows too, but that hasn't seemed to have made much of an impact thus far.

One IE per OS Without jumping through some serious rings of fire, you can only have one version of Internet Explorer on any Windows OS. As people upgrade their computers, IE 6 will no longer be available to them.

Lack Of Support Yes, this is a somewhat hypocritical counterpoint to my previous position indicating designers do not have much influence. Some absolutely huge sites are slowly dropping IE6 support and notifying those users that other browsers are available. This will help educate users that other alternatives are available.

But, the real champion for the death of IE6 is a somewhat unlikely candidate: Microsoft itself.

Windows 7

This will be the single greatest influencing factor in IE6's decline. Many companies (perhaps most) skipped migrating to Windows Vista. With the release of Windows 7 imminent, many of those same companies will be upgrading this time around. Few companies want to fall more than one release behind the upgrade curve, as the expense to migrate becomes larger and larger with each release. Windows 7 will have IE8 as it's default browser. Expect to see IE 6 usage drop like a stone over the next six months, followed closely by IE7, and for IE8 to respond with more or less equal gains.

Windows 7 Professional will have XP mode and some companies will be slow migrating their IE6-dependant apps, but you can bet their employees and managers alike will complain about having to use IE6 in the virtual machine instead of the fancier IE8. Those complaints, aided by the likely already in development upgrades to said apps in preparations for the Windows 7 migration, will ensure that those older apps are replaced within a reasonable timeframe. This will remove any remaining excuses for corporations to keep IE6 among their supported applications.

The Decline Has Begun

IE6 usage has been declining somewhat steadily for years. This decline will continue. Here are some significant signposts of that decline.

YouTube YouTube posts a warning message to visitors using IE6, indicating that their browser is out of date. Other tech-savvy sites will be sure to follow their example.

W3C The godfathers of the internet *cough* track browser stats which illustrate that from Jan '09 to September '09, IE 6 visitors have dropped by 6.4%. Many people extrapolate W3C's site stats and apply them to the internet as a whole, but that is a gross mistake. Not only are all such statistics regionally spun, W3Cs stats appear to revolve mostly around visits to their own website. (They do monitor other sites, but to what extent I do not know.) At the very least, we can assume that there are less web designers visiting their site with IE6, which indicates support for IE6 on a whole is experiencing a downward trend.

Net Applications In my opinion, Net Applications has the best browser stats available on the internet. They amalgamate data from a huge amount of varied sources. I won't reproduce their data here, but here is a comparison of browser support from Sept '08 to Sept '09:

IE (all versions) down 9.4%
Firefox up 5%
Safari up 1.4%
Opera up 0.1%
Chrome up 2.7%

The only major browser to lose market share - and a substantial chunk at that - was Internet Explorer.

The end is coming folks. I'm not sure any of us have the power to hurry it along, but be patient. The end is coming. I predict IE 6 will have 5% market share or less by this time next year. That's a number that is safe enough for most conservative designers - and businesses - to drop support.

But Until Then...

Supporting IE6 can be made easier. I have gathered many tips for working with IE6 over the last little while. I apologize but I am unable to accredit most of the original sources as I do not know who they are, but their efforts are appreciated.

Design with standards first, then compensate for IE6 afterwards. This will save you time in the long run.

Use a CSS reset style to bring all browsers closer to a baseline default.

Use conditional comments to add an IE6-only CSS after other CSS links have been applied. This is the most efficient way of supporting the dinosaur.

If you are doing something noteworthy on your site that is not supported by IE6, utilize conditional comments and/or JavaScript let those visitors know what they are missing out on.