Nintendo Wii

April 27, 2006

You all probably saw that Nintendo gave an official name to their next-generation console, until now codenamed Revolution: Wii. Pretty much everyone and their sister agrees that it’s not the best name in the world, and it’s definitly not a better name than Revolution.

The only explanation that I can come up for this name is that someone at Nintendo watched this video one too many times.


Never thought I’d side with Sean Hannity

April 25, 2006

I never thought I’d see the day where I would agree with something Sean Hannity said. But this video proves that whenever you think you’ve reach the absolute rock bottom of stupidity and insanity, a so-called human being goes ahead and shatters your reality and you need to set even lower standards for humans.

Seriously, this woman is crazy. Like a frog.


Hungarian notation vs thesauraus

April 25, 2006

A couple of weeks ago, I was asked at work if I was interested in transfering from the infrastructure team to the development team. I wasn’t sure at the time, so I asked if I could check out the nature of the work to make my choice. I was given a book on the language used and a Word document that explained the different style guidelines.

The programming environment was HyperScript for JSheet. Most of you probably have never heard of it, and you can be thankful for that: it’s certainly the suckiest development environment and language I have ever seen. However, I’m not here to talk about it today, I’ll do that in another post at a later time. For now, I want to focus on two elements of the guidelines that would’ve drove me nuts if I had accepted the position.

Do not use single character variables

The first guideline was that you could not use a single character variable. Sounds reasonable mostly, some people often go way nuts with variable names nobody can understand. However, this was taken to the extreme here. In most, if not all, programming languages, when you need to loop over an array using indexes, you use i when you have one dimension, i and j when you have two dimensions, i, j and k when you have three dimensions and you rarely need to go beyond that. I know it’s used in Ruby, Python, C, C++, Java, Forth, Smalltalk, Lisp, etc. The guidelines strictly prohibited this however. You should call your index variable i_index. When you have more than one dimension, you should use i_something_meaningful_in_the_array.

This seriously hurts readability, makes the code horizontally longer and brings no benefit. Because of the ubiquity of i, j and k in all other programming languages, this would actually make code more readable.

Use hungarian notation for all variables

The second, and most annoying thing in the guidelines was that all variables were to be named in an hungarian style. For those of you who don’t know what it means, it’s a naming convention where you put relevant information (most often, the type) regarding the variable in the variable name itself. Some example would be floatAverage, arrayEmployees or stringFirstName. The reasoning — as far as I can understand — behing this naming scheme is to give more information to the programmer regarding the variable, so it’s easier to follow a program, to jump right into it.

Some programmers may agree with that; I don’t. I find that this extra information adds clutter to the names, and that the code suddenly becomes harder to read, because you don’t read it like you’d read instructions, you are always reminded of implementation details.

The conventions I would’ve had to follow were the following:

g_ : global variable
p_ : function parameter
a_ : array
i_ : integer
f_ : float
c_ : char
s_ : string
h_ : constant
dt_: DateTime

Nice, eh? Well it gets even better: these are pluggable together. Yes, yes, so if you have a global array of employee names, the name of the variable would be gas_employee_names. Maybe it’s just a question of habit, but it seems that when I read code like that, my mind stops to analyse the meaning of ‘gas’. “Oh right, that’s a global array of strings.” I don’t believe that’s a good practice.

A while ago, Blaine Buxton, a Ruby and Smalltalk programmer, wrote a blog entry where he mentionned that he used a thesaurus to find the best word to describe an object. I think that carefully choosing names wins over hungarian notation. For instance, if you have a variable named as_first_names, why don’t you just lose the “as_” prefix? It can be mistaken for the word “as”, and secondly, it’s completely unneeded here: first_names would indicate more than one first name, and I don’t think anyone is named 17.3 or -47, so it’s safe to assume that you’re dealing with strings. The same goes for salaries: it’s pretty safe to assume a collection of floats representing salaries, don’t you think?

There’s also the question, when do you stop? In Smalltalk for instance, there is a large set of collection classes which can contain any sort of object. How do you call an instance variable ordered collection containing DateTime objects? ivOcDtEmployeePunchTimes? That name looks like somebody was fighting a spider before typing “EmployeePunchNumber”. And with the number of classes in Smalltalk, you may end up confusing the prefixes; does “Dt” stand for DateTime or for DispatchTeam?

Hungarian notation is also a problem when you decide to change the implementation of your program. For example, you decide that you want to use a different kind of number in an array, you want to replace integers with floats. You need to change all instances of gai_variable to gaf_variable. That can be made pretty easy with search and replace, but that’s still an extra operation. Had the name been chosen to evoke an array of numbers, but without specifying what kind of numbers, that second operation would be unnecessary.

In the book “Smalltalk Best Practice Patterns” by Kent Beck, Kent extensively talks about choosing good names to clearly communicate your intentions and making sure that reading your code flows. Leo Brodie has similar thoughts in “Thinking Forth”. My opinion is that every time you read a variable name in hungarian notation, you go from the thought mode where you think of the solution to the mode of thought where you think about the implementation of the solution.

By the way, I am not going to be programming in HyperScript for JSheet. This means that in one week and a half I will have no job, but I think I’m happier being unemployed than having a job I would hate.


Smalltalk and remote programming?

April 23, 2006

Today, I fell on this old post by Ian Bicking on Slashdot regarding Smalltalk. He asks a pretty good question to which I have no answer since I don’t work much with Smalltalk, I just like to use it for fun: how do you work from a remote location?

For instance, you’re at a friend’s home on a Saturday night when you cell rings, it’s work, there’s a pretty big bug in the software and they need it fixed ASAP. With a language that uses text source files, you could use your friend’s computer with Notepad.exe or what have you, make the fix, upload it back and go back to your Bailey’s.

How does that work with Smalltalk and the whole image environment thing? One nice thing I saw in Seaside was a web interface to the Smalltalk browser, so this might be a possibility. Another one might be a remote connection (VNC, Remote Desktop), whatever. I think James Robertson might talk about this in his StS speech; if memory serves right, he is talking about the blog server he wrote, and I believe he mentionned in some posts on his blog that all he does when he’s done working an update is upload “something” onto his production server. Now, I don’t know what the something is; a fileIn, another image, a patch?

I’m not sure if many Smalltalk people read my blog, and if they do, most of them are probably having a blast at Smalltalk Solutions in Toronto, but I’d like input on this. Thanks in advance.


Brain Age

April 19, 2006

I bought Brain Age for Nintendo DS yesterday. If you want a different kind of game, that is both challenging and enjoyable, you should get your hands on Brain Age. The exercises really make you think. I especially like the number games, where you need to answer either 20 or 100 simple arithmetic problems (addition, substraction and multiplication from 0 to 9). My record for 100 so far is 1 minute 55 seconds. A little under 1.2 seconds per problem. The word game where you need to memorize something like 24 words in two minutes and then you have 3 minutes to write them all down is pretty intense too.

Can’t wait to play in multi-player! I’m gonna go read the reviews now, see if anyone else agrees with me. But from what I can tell, I’m gonna be having a whole lot of fun with this game!


Google Calendar

April 13, 2006

I tried Google Calendar today. Nice, pretty good UI, I like it. Now, can we get SMS for Canadians, please? Until then, I’ll keep entering my stuff into my cell phone.


Thoughts on TV Shows

April 12, 2006

I’ve been watching a lot of TV shows lately (american TV shows mostly), and I thought I’d take some time and give my thoughts on those shows here.

Smallville

A nice show about Clark Kent’s teenage years. The episodes of the first season were pretty simple: a random character gains super-human powers due to cryptonite, goes out and does evil things, Clark (usually with the help of Chloe and other friends) finds out and decides to stop the weekly freak, confronts him, but, oh noes!, there’s cryptonite and he’s suddenly weak! Not to fear, for some reason his opponent brings him away from the cryptonite so he can fight back, he knocks them out and usually saves Lana Lang in the process. That was a pretty simple formula, but thankfully they decided to make the show more involved starting with season two with the caves, Jor-El, the red cryptonite and in later seasons, the infamous three stones of power (or whatever they’re called.) I finished the DVDs of season 4 when Clark is in the mountains somewhere and Lana crashed in helicopter and found a spaceship.

Tom Welling is a decent Clark Kent, although he doesn’t look nearly as shy or awkward as Christopher Reeve made Clark Kent look in the original Superman movies. Kristin Kreuk, who plays Lana Lang, is the most beautiful girl in the entire world and it is impossible that she can smell bad. When she farts, it smells like vanilla!

Alias

I watched the first season of Alias and started the second one just last night. The show is a pretty decent espionnage show, although some parts are unrealistic, such as the whole Rimbaldi affair, Sydney being able to live a semi-normal life with her friends, her mother being The Man, etc. Nevertheless, it’s entertaining, so it’s fine with me.

Lost

I bought the first seasons on DVD this summer without knowing anything about the serie except that people said it was really, really good. And it was great! The mysteries of the island completely glued me to my TV (see a previous post for some of the mysteries.) The (many!) characters were also really diverse and attaching and it was nice to learn a little more about their background every show.

I decided to watch season 2 on TV, because I didn’t think I could wait for the DVD pack. I first thought that the second season was weaker than the first one: the other group (Anna Lucia, Mr. Eko, etc.) was not as interesting IMO as the original Jack/Kate group. However, once the two groups merged as one, things started rolling again. And with the great episode two weeks ago where Locke sees a map on a blast door, I think the second season is now in full speed! Can’t wait to learn more about that map, the “Henry Gale” guy, etc.

24

Fifth season of the show 24, and I am still completely addicted to it! It’s a very powerful season: many characters we came to know and love in the previous seasons were killed off, practically every episodes ends with a cliffhanger that makes you want to tear your hair out and Jack is more bad ass than ever!

Some people complain that 24 is about as realistic as President Bush saying war in Iraq was a mistake, but I don’t care. If I wanted to watch realistic stuff, I’d watch the news. I want excitement, unexpected plot twists, I want to be surprised, I want to love some characters and hate others. And 24 delivers on that. Keifer Sutherland just signed for three more seasons, and if the writers can keep the same quality, I’ll still be watching the show in 2009!


Best scene ever :)

April 10, 2006

I can remember the first time I saw the first Gunnery Sergeant Hartman scene in Stanley Kubrick’s Full Metal Jacket :) Man this guy can insult people without thinking twice about it!


Oklahoma + Linux = FREAKS!

April 10, 2006

Seen on The Register:

“This is just a bunch of freaks out there that don’t have anything better to do,” Taylor said.

“When I came in to work Monday morning, I had about 500 emails, plus anonymous phone calls from all the geeks out there. (CentOS is) a free operating system that this guy gives away, which tells you how much time he’s got on his hands.”

I wonder if that includes Blaine?

Update: Oops, Blaine is from Omaha in Nebraska. Sorry about the confusion. s/Blaine/TheLinuxDuck then :)


The mysteries of Lost

April 7, 2006

I don’t think this list is complete, but here are the unsolved mysteries of Lost that I can think of:

  • Who is Libby?
  • Who is Henry Gale?
  • Where’s Michael?
  • Where’s Walt?
  • Does Walt really have “powers” that make what he thinks about actually happen?
  • Who are the others?
  • What do the others want?
  • What’s the purpose of the hatch?
  • Why do they have to keep entering those numbers?
  • Do those numbers represent something?
  • What happens if they don’t enter them?
  • What did Henry do when he went into the computer room?
  • Where did the food come from?
  • What was the map Locke saw on the blast door?
  • Has Hurley ever not called someone “Dude”?

Feel free to add more in the comments, I’m sure I missed some. It’s a wonder that a show with so many intrigues still is so popular. A show made in Quebec called “Un Homme Mort” (A Dead Man) is not going to have a second season because they lost a large part of their ratings because it’s — supposedly — too complicated. Not sure I agree with that, but whatever.