(identity 'myron)

Tue, 27 Sep 2005

Ruby On Rails and Plurals [/programming]

I've been learning Ruby on Rails lately which is quite clean and elegant, but that's not what this post is about. From the moment I found out it attempts to auto-pluralize object names, I've been itching to bang on it to see what it understands and what it doesn't. The only thing I've heard said about it is that it's smart enough to understand child and children, person and people.... Well then, punk, let's go for a ride around the mess that is the English language, shall we?

% rails plurals
[a bunch of output about creating files and directories]
% cd plurals
% ruby script/generate model Child
[...]
    create  test/fixtures/children.yml

Works as advertised. Let's move on.

% ruby script/generate model Spy
[...]
    create  test/fixtures/spies.yml

Not bad, but still only smart enough to earn a preschool star sticker. What if my app's all about the world of fantasy fiction?

% ruby script/generate model Elf
[...]
    create  test/fixtures/elves.yml

Ok I'm mildly impressed at this poi—oh who am I kidding—it's time to bring out the big guns!

% ruby script/generate model Torpedo
[...]
    create  test/fixtures/torpedos.yml

Wrong! But most people won't even notice. Let's try something similar but more obviously wrong.

% ruby script/generate model Hero
[...]
    create  test/fixtures/heros.yml

Hehe. Now for nouns that have no plural forms at all.

% ruby script/generate model Deer
[...]
    create  test/fixtures/deers.yml
% ruby script/generate model Sheep
[...]
    create  test/fixtures/sheeps.yml

And finally the test for some Italian:

% ruby script/generate model Concerto
[...]
    create  test/fixtures/concertos.yml

For the record, this was done in Rails 0.13.1. Some other interesting examples it got right: Octopus/Octopi, Symposium/Symposia, and Vortex/Vortices. Oddly enough for each one of those, I could find a noun in the same "class" it would get wrong. It pluralized Fungus instead of Fungi, Ovums instead of Ova, Appendixes instead of Appendices. So go figure.

// posted at 19:58. permalink   comments

divider symbol

Sat, 10 Sep 2005

The Prisoner [/misc]

I grabbed the entire seventeen episode set of the 1967 TV show, The Prisoner, recently and even after having only watched up to episode six, it's easily one of my favourite TV shows of all time. For those who aren't familiar with it, see the Wikipedia entry for a synopsis.

Chock full of witty dialogue, it's a reminder that TV shows can be entertaining and intelligent at the same time. This is true despite its age. And even though it involves use of technology, it doesn't look so dated that it's distracting. The only time I really let out a chuckle was in "A, B and C", where Number 2 is speaking into a giant red telephone. More surreal than outdated though.

Number 2 speaking into a giant red phone

In any case, this is a show well worth watching, even if only to see the source of all those cultural references made in movies and TV shows like The Matrix, Simpsons, and The Truman Show. The acting is excellent, each episode is thought provoking, and overall, I have yet to see any show tackle questions of identity and society quite like this one does.

// posted at 10:15. permalink   comments

divider symbol