Main

August 5, 2005

There’s a reason I use Thunderbird’s weblog-reading component: there’s just too much good content on the Web these days. The last week or two brought in an abundance of computer-related goodies, including these about Microsoft, Opera, and Mozilla:

  • MS Anti-Spyware built on MS Abandonware – After coercing so many developers and companies to hop on the .Net bandwagon, the last holdout may be Microsoft’s newest division. [1]

  • MSN Virtual Earth: Microsoft Takes on Google – Being the creature of habit that I am, MSN’s new Google product clone won’t see me very often. It might have some slick animation when zooming in and out, but if Microsoft doesn’t have the resources to include Apple’s headquarters in their database or remove the World Trade Center towers from it, then Microsoft may’ve just put Google Maps’ questionable reliability in perspective.

  • Standards and CSS in IE – Everyone was anxious to see what Microsoft had added and improved for IE7 beta 1, which was released in tandem with the Windows Vista beta. But when some prominent bloggers tried the new browser out, they were largely disappointed: aside from the copycat tabbed browsing and awkwardly placed toolbar, not much had changed. Fortunately, the IE team came out with a blog post on the subject, and surprised me with the list of Web standards features that they plan to support in later betas – they’re promising pretty much all I wanted: the abbr tag, better CSS selector support, transparent PNG, and :hover on arbitrary elements, plus a host of bug fixes involving margin handling. [2]

  • Opera to stop spoofing User Agent as IE – When I started using Opera back in the days of version 2.x, the first option I changed was the user agent string: Opera attempts to trick clueless Web designers into thinking that it’s Internet Explorer, so that they don’t send Opera “upgrade now” messages and other annoying nonsense. (Extensions for Mozilla and Firefox have done this for ages as well.) Now, Opera feels confident enough to start using its own name by default. [3]

  • What’s in a name? – Round Two, formerly known as MozSource, is now known as the Flock. Sounds like another mozilla/browser → Phoenix → Firebird → Firefox. They’re working on one of those “social browsing experiences” (think del.icio.us).

  • Mozilla Foundation Announces Creation of Mozilla Corporation – I’m still trying to decide whether I think this move is a good thing or not… [4]

In case I haven’t bored you enough, how about a few links on programming and application development?

  • Hitting the High Notes – You can’t make up for having poor programmers by having hoardes of poor programmers. Sounds kind of obvious, but maybe the project management types will need to read this.

  • JavaScript Archive Network – If you’re looking to add some basic functionality to your large program, but don’t want to spend time implementing it yourself, this JavaScript counterpart to CPAN might become your best friend. It already has plenty of JavaScript libraries available for download. Yes, I said JavaScript libraries – JavaScript is a real programming language. [5]

  • Human-Centered Design Considered Harmful – No, the user doesn’t always know what they want. You have to be the boss sometimes. [6]

Some of the things that popped up this past week just made me scratch my head. Various bloggers noticed Apple’s new “Mighty Mouse,” a mouse that includes two buttons (!) that you can’t see and an “ingenious” little scroll ball. The thing is, I’m not sure how you’re supposed to use that scroll ball; the plethora of images on Apple’s website don’t really help. I suppose that’s why they have an Apple Store in Kenwood.

In addition, Google’s partnering up to provide a service called Current TV. It looks like an online cable channel comprised of podcasts. I’ve yet to take a close look, and I’ve yet to see why I should.

I’ve still got a host of good links in the queue, by the way.

June 13, 2005

I’m not a religious fanatic when it comes to opposing Microsoft and their products – really, I’m not. I use Windows and Office and the PowerToy Calculator every day, after all. But I used to be an anti-Micro$oft zealot, and it still shows.

A few days ago, Peter Rother posted a comment to inform me that the St. Xavier Forums (henceforth to simply be known as the Forums in these parts) had gone down, and was showing the trademark ASP error page, generously archived by Peter Rother. When Peter Franklin, the Forums’ administrator, acknowledged the problem, I couldn’t help but use the opportunity to plug some forum software that I happened to find more attractive than ASP.NET Forums.

Guess I forgot the all-important initialism IMHO.

Peter quickly turned defensive, seeing through my shotty anti-Microsoft evangelism, and caught me by surprise. I was initially arguing against Microsoft’s .Net languages, yet my last dealing with those languages was Visual Basic 6.0 Learning Edition – I was obviously in trouble from the start. That, combined with my eventual defense for JavaScript of all things, doomed my side of the argument, and I’m sure Peter had a great laugh about it each night, as he responded to me point by point.

I later took his advice, trying my best to change the subject to topics I knew about like Lisp, Python, and – would you believe it – more of JavaScript, but it always came back to the same thing: Peter knows enough about the language he’s defending that I can’t beat him with my sparse knowledge of a language I’m just learning.

For some reason, I always felt compelled to respond to Peter, fully knowing that I would only make more of a fool of my stubborn self in the process. If the thread weren’t to end, I would’ve probably resorted to telling outright lies about JavaScript to get my point across. Fortunately Peter closed the conversation for me. I walked away in shame, but I was getting tired, and I know everyone else was, too.

It would behoove of me to retreat to my cave and continue learning the languages that I prematurely set out to defend. There are certainly better things to do during the summer than to exchange heated words like this.

May 15, 2005

This is one of those blog entries that I’ve been procrastinating for awhile. It’s about programming, so if you’re not into computers and the like, you’d best scroll down below this entry now. Go on. I won’t begrudge you.

Joel Spolsky is a software developer in New York, someone whose articles I’ve linked to plenty of times in the course of making a point, but whom have never actually mentioned. Seemingly as often as I update my blog – in spurts, that is – in spurts – he publishes a really eye-opening story relating programming with The Real World™.

So enough with the boring introduction: “Making Wrong Code Look Wrong,” his latest article, is one that only aspiring programmers would ever want to read.

This is the real art: making robust code by literally inventing conventions that make errors stand out on the screen.

So now I’ll walk you through a little example, and then I’ll show you a general rule you can use for inventing these code-robustness conventions, and in the end it will lead to a defense of a certain type of Hungarian Notation, probably not the type that makes people carsick, though, and a criticism of exceptions in certain circumstances, though probably not the kind of circumstances you find yourself in most of the time.

But if you’re so convinced that Hungarian Notation is a Bad Thing and that exceptions are the best invention since the chocolate milkshake and you don’t even want to hear any other opinions, well, head on over to Rory’s and read the excellent comix instead; you probably won’t be missing much here anyway; in fact in a minute I’m going to have actual code samples which are likely to put you to sleep even before they get a chance to make you angry. Yep. I think the plan will be to lull you almost completely to sleep and then to sneak the Hungarian=good, Exceptions=bad thing on you when you’re sleepy and not really putting up much of a fight.

I first learned about this ridiculous thing called Hungarian Notation while learning Visual Basic 6, from a book called Visual Basic 6 from the Ground Up. (Ick… Visual Basic… it wasn’t the highlight of my computing career.)

Here’s what the author, Gary Cornell, says about Hungarian:

Some programmers like to use the convevntion of adding a lowercase prefix to variables to indicate what type they are. … This is usually called “Hungarian Notation.” … I don’t use Hungarian notation for variables in my code, preferring code that reads more easily in English. I simply find sngInterestRate to be a less appealing name than InterestRate. … Certainly, almost everybody uses “Hungarian style” prefixes for the names of controls as you saw in Chapter 4: txtFirstName, for example, as the name of a text box. The following table summarizes the Hungarian prefixes for the basic data types:

He goes on to include a table with the basic Visual Basic types – String, Boolean, Integer, etc. – and their prefixes. According to Spolsky, this would be the much-hated “Systems Hungarian,” the source of great misunderstanding over Hungarian Notation.

As it turns out, I got used to the convention quite rapidly, because everything in MSVB involved Systems Hungarian. As Cornell correctly noted, every control on a form was named with the trademark two- or three-letter prefix. Perhaps it was a bit useful, because there were simply so many types to keep track of – one for every control. But it was just a pain to type out.

Spolsky’s points out that people dislike Hungarian because they misunderstand it. Charles Simonyi (Simonyi Károly), the developer of the original Hungarian Notation, intended that the prefixes would indicate things like whether the String variable was escaped or not, or what purpose the variable served. This can cut down on a veritable ton of comments in the code, as I later discovered. But Simonyi quite consistently used the word “type” – instead of “characteristic” or “purpose” or “kind” – in his paper to describe the function of a variable, so the people who popularized his convention ended up popularizing the wrong thing: what came to be known as Systems Hungarian.

Sophomore year, when I first told Mr. Hoar that I used Hungarian Notation, he had no clue what I meant. It turns out that he was only familiar with the capitalization rule of Hungarian, which he called “Hump Notation,” but is more commonly known as “mixedCase.”

Now, I try to use the original, more useful form of Hungarian, known as “Apps Hungarian.” As I mentioned before, it cuts down on a lot of comments, because the prefixes that I include in each variable name actually tell me something about the variable that I’d otherwise need to put in a small comment to the side, something that the IDE couldn’t readily tell me.

Spolsky’s main argument (before he digresses into a discussion exception-based programming) is that using a convention like Apps Hungarian can actually cut down on errors. Security-sensitive information like whether a string is encoded or not is right there in front of you, not shoved over to the side in a gray, italicized comment. It can also help out with complex programs in which you could have a hierarchy of variables, each with its own special purpose in life: by using a consistent set of brief prefixes or mneumonic devices in the variable (or function) name, you also cut down on the required length of a variable name.

So instead of having a variable _hungarian_date_format_re1, which somewhat resembles German on a bad day, you can have _redHungarian, since the script I took it from defines quite a few of these date format regular expressions. The underscore is there because it’s a global variable in Python. Although languages like Python now allow underscores as part of a variable name, seemingly defeating the purpose of Hungarian, the underscore is still a hard character to type, compared to the Shift key.

And since I spent the whole day sifting through nearly all the language editions of Wikipedia, I happen to know that hu is the ISO code for Hungary and the Hungarian language, I’ll simply call the variable _redHu.

(Read the rest of Joel Spolsky’s article, and let me know if I missed or misunderstood something.)

Notes
  1. A regular expression matching the Hungarian date format (no kidding!), taken from the source of Mark Pilgram’s Universal Feed Parser, written in Python. ()

 


  1. Catching up
  2. Misplaced zeal
  3. Face it, you’re wrong
  4. Here’s a cupholder