Archive for February 6th, 2008

Apparently the creator of Ruby on Rails doesn’t comment his code … kinda

Here’s some excerpts from DHH’s post and comments yesterday on 37 signals

  • The short answer is that we don’t document our projects. At least not in the traditional sense of writing a tome that exists outside of the code base that somebody new to a project would go read …
  • Further more, I don’t really find it necessary for the kind of work that we do. Our biggest product, Basecamp, is about 10,000 lines of code. That really isn’t a whole lot in the grand scheme of things. Everything we do is build is also using Ruby on Rails, which means that most Rails programmers would know their way around our applications straight away. It’s the same conventions and patterns used throughout.
  •  Finally, we write our application in a wonderfully expressive and succinct programming language like Ruby that leads itself very well to a programming style like the one Kent Beck preaches in Smalltalk Best Practice Patterns. Keep your methods short and expressive. On average, our models have methods just four lines long. Adding documentation to a method should usually only be done when you’re doing something non-obvious that can’t be rewritten in an obvious way.
  • [comment] Wim, yes there’s RDoc. I just generally don’t use it for projects. When methods are only an average of 4 lines long written in a language like Ruby, it’s often faster and better to merely browse the code base rather than rely on explicit commenting.

Keep in mind that I’m no Ruby on Rails genius, and from the little I’ve done I can see where DHH is going with this. But I’ve always thought that this argument of a language being so succinct and clear that you don’t have to write comments is just a bit silly for a couple of reasons.

  • I believe that you don’t write code for machines, you write code for people (other developers). So any help you can give them in navigating your code is typically good to have. It saves them time and their employers money … that is what being a great consultant is about, you have to be thinking in terms of how to help your clients’ business and saving them money falls in that category.
  • People who use this line of argument are either too lazy to comment and are trying to justify it …
  • … or don’t understand that there are developers of all skill levels in the industry. So whereas, someone with your skill level would be able to navigate your code quickly, someone who wasn’t as good might take longer …why not avoid that.

Note, that I’m not of the school of thought of commenting just for the sake of it, like I’ve heard some “blub programmers” do. However, I do think that you should always be thinking of other developers when you code and if commenting can get them to a point where they can modify your code in 1 minute instead of a minute and a half … then you should comment.

In the end, I guess its a bit unfair to criticize DHH, because its not clear that he doesn’t comment his code much … though its easy to infer that. I just know from my experience that people who say things like he says have a tendency to have 3 lines of comments in some piece of code 500 lines long.

But if you’re a “rockstar developer, I guess everyone has to dance to your tune, wherever you are right?

Add comment February 6th, 2008

Bad UI design no more … Facebook re-designs their search box …

Boy do I feel special! Regulars will remember that I blogged about the bad ui choice that was made with Facebook’s omnipresent search box a few weeks back.

Well, I went into Facebook today and was prattling off about one thing or the other when my eyes fell on this.

Facebooks new search box

this is what it looked like as of January 9th 2008.

01-09-200802-47-34-pmcroppercapture.Png

As you can see, it would seem that they took my recommendation to add an actual clickable button to the search box, so that mobile phone users could actually use it.

Of course I kid (kinda) about about being responsible for the change. After all why would company valued at $200bn listen to a lowly Austin Web developer with a blog and an opinion. I don’t know for sure, but I’ll claim it … if only for the fact that no one else is:) Steven Colbert did it with Mike Huckabee’s success in Iowa, and I’m doing it here.

Good job Facebook!!!
[Now, if they would only allow embeddable videos in Facebook notes ....]

Add comment February 6th, 2008

How to get delete key to actually delete on a Mac running windows xp with bootcamp

On windows xp on bootcamp, the delete key actually does what the backspace key should do.

To get it to act like it should, just hit hold down [fn] then delete to your heart’s desire.

Add comment February 6th, 2008


Recommended

Posts by Category

Calendar

February 2008
S M T W T F S
« Jan   Mar »
 12
3456789
10111213141516
17181920212223
242526272829  

Posts by Month