Subclass this

Subclass this

In object-oriented languages there’s a nifty feature called code inheritance. People tend to think that this is a really cool ™ thing, since it allows you to quickly slab some new features onto a class whenever the need arises. In fact, there still seems to be a lot of folks who think that the whole point of object-orientation is to subclass a lot.

I’ve previously worked with Microsoft MFC, which was designed that way (but remember, that was back 1992) – as was the class hierarchy that makes your Unreal Tournament tick. I’ve seen object hierarchies spreading over 15 levels, and more.

The only problem with code written that way is that it sucks. A lot.

Read more…

Rails forms and params

Rails forms and params

Another not to self: Rails has the cool feature that you it will map all the values from your submitted forms into the params hash. And, if you create input fields that are named “something[bla]“, it will automatically create a nested hash so that you will be able to access params[:thingyform][:something].

But what if you just have a list of things that you need to submit? In this case, just name multiple form fields something[], and the params will contain an array.

Rails course in Paris – Documents

Rails course in Paris – Documents

Here’s some material for the Ruby on Rails course I gave at the University in Paris this week, on invitation of Prof. Fouquere. You can download the presentations slides (also the ones for the second day) if you like. There’s also a git repository for the tutorial application that I built, and another one for the simpler tutorial application that the students created.

Read more…

gitcrap again

gitcrap again

Didn’t I talk about GitHub already? Didn’t I mention how it breaks down in the most obscure places and how they think being cool is a license to mess with their clients? Well, it just got better: They cut the gem building service. Not only that, but they didn’t know in advance… I’m not impressed.
Read more…

git submodules

git submodules

Today’s lesson is mainly for the people who want to use the Talia source code, but it could be useful for many git users, so I’m putting it here. In our code we use git submodules a lot; they are a bit like the good old svn externals but have different quirks that are not that easy to understand. And of course neither the official documentation nor the tutorial explain it in more detail. (I’ll assume that you’re already familiar with the general concept):

Read more…