Wednesday, July 09, 2008

Lazy programmer and why Lisp templates suck

I was reading some random article on Rediff and happened to notice this block shoved in one corner. What caught my eye was the first question - "Are commodity exchanges responsible for price raise of food grains?" - but I got easily distracted by the sheer laziness of the developer who implemented this. Check out the screenshot below:

1 answer(s)
5 answer(s)

I mean for god's sake! On one hand we have people who're trying to teach computers natural language processing, and artificial intelligence; and on the other hand computers can't figure out if was one answer or five answers.

Then I thought, how easy it would be to implement this in ERb:
<%= post.answer_count %> <%= post.answer_count==1 ? "answer" : "answers" %>

And then I got thinking how damn painful it would be to implement this in Lisp and HTML-Template. You'd first have to create a flag for each post indicating whether it had a single or multiple answer. Then you'd have to pass all those flags (or list of flags) down to the template filler function. Then you'd have to put a big TMPL_IF statement in the template to achieve the same thing:
<!-- TMPL_VAR answer-count --> <!-- TMPL_IF single-answer -->answer<!-- TMPL_ELSE -->answers<!-- /TMPL_IF -->
You could of course, for each post, simply compose the exact string to be displayed ("1 answer", "5 answers") and pass that down to the template. But what's the point of having templates if you can't separate view logic cleanly.

Lisp is a great language, which will probably help you achieve a lot of intellectual orgasms (Meta-object protocol, macros, reader macros, etc.) But it sure does need a good templating tool. I tried hacking around in CL-EMB, but it doesn't really cut it.

[End rant]

Wednesday, July 02, 2008

IIT Kanpur Suicides - Werther Effect/Copycat Suicides?

Yet another suicide rocks IIT Kanpur. Yet another round of introspection. More statement blaming the student-faculty relationship, internet usage, grading system and academic pressure. Media bites with ridiculous statements from, both, the students and the faculty.

I'm not sure how much the situation has changed from my times - and they're not too far in the past, I'm a 2005 graduate - but, I really don't think that the academic pressure is too high at IIT Kanpur. Any lower, and it'll risk getting lost amongst the gazillions of second and third rung engineering institues in the country.

Ditto with the grading system. It's not the best, but it's not the pits either. Every system has its pros and cons. And the cons are not that bad that they'd cause students to start committing suicides over them.

I think the suicides are because of an individual's intrinsic character and the Werther Effect. I first came across the Werther Effect while reading the chapter on social proof in Robert B. Cialdini's book, "Influence - The Psychology of Persuasion." The Werther Effect talks about how a highly publicized suicide can cause a number of follow up copy-cat suicides amongst people in the same situation. And suicides in IIT Kanpur (or any other IIT for that matter) are surely highly publicized. You have it splashed on the front pages of all local newspapers, the in-campus newsgroups would be flooded with posts, discussions in the quads & wings, special committees and reports, etc.

When I first read about the Werther Effect, I scoffed. But, now I've started believing in it. An extract from the Wikipedia article:

The well-known suicide serves as a model, in the absence of protective factors, for the next suicide. This is referred to as suicide contagion. They occasionally spread through a school system, through a community, or in terms of a celebrity suicide wave, nationally. This is called a suicide cluster[1]. Examples of celebrities whose suicides have inspired suicide clusters include the Japanese musician Hide and Yukiko Okada.


I think some psychology/sociology professor from the IITs should be looking at this angle as well. In my opinion, the grading system and the academic pressure is just fine. Let's not degrade the quality of IITs any further - we've got politicians to do that for us!