This was presented as my Lightning Talk at the 2001 YAPC.

Ways that Object-Oriented Programming is like Japanese Food

I think both Object-Oriented Programming and Japanese food are significant aesthetic and stylistic achievements -- they're both about taking simple meager ingredients and making something remarkable.

When I'm in the mood, I think Japanese food and OOP are minimalist. Perfectionist. And perfect.
When I'm not in the mood, I think they're both tedious, and so very bland -- at best!

I say "at best", because when Japanese food gets really nasty and then tries to get un-blank, you get this occult goo that Japanese people optimistally call "curry" -- or, even worse, they get out the tonkatsu sauce. These are both bad things, and even wanting them is a sign that everything is just wrong.
And the OOP equivalent of those danger signs is, of course, iterators. [Except in streams!]

Some people get one of those sushi-rolling mats, and they go hog wild, and they're suddenly thrilled with their culinary inventions -- the same way some people just love to design class hierarchies.
And I'm glad you're proud of your UML chart of your seven-layer-deep date class hierarchy, and that you're proud of your cajun walnut sushi -- but, really, just keep them both away from me!

Behind OOP and Japanese food, there's a whole literature (with highlights like Itami's Tampopo and Conway's Object-Oriented Perl), and behind that there's a whole philosophy that's accreted -- which I think you should be able to take or leave:
But ideally, you don't just make sushi, for example -- you live the whole arcane art of sushi-dô.
And ideally you don't just do OOP -- you practice Object-Oriented Design, using Object-Oriented Methodologies, or "OOD" and "OOM" for short. (I just like saying "OOD".)

Public opinion is that both OOP and Japanese food are "good and good for you", and both simple and pretty. And they are! But that doesn't automatically make them intuitive, much less easy. Both are, in fact, much harder than they look.

When given a programming project, you don't "solve" anything by declaring that this project will be done in OOP, any more than you "solve" anything be surveying a set of ingredients and declaring that they are to be cooked Japanese-style.

Specifically, some sets of ingredients just don't work that way:
If you open the cupboard or the fridge, and what you see is cinnamon sticks, Contadina tomato paste, six potatoes, and some butter, well, you're not going to have Japanese food tonight; and please don't try!
Similarly, if you're writing an Atari 2600 emulator, I don't way to hear the word "object" mentioned, even in jest!

As to learning these things, trying to pick up good object-oriented practices from reading Java source is like trying to glean Japanese culinary secrets from eating a lot of instant ramen.
In fact, I'll say it: Java equals Top Ramen -- except that making it takes three hours. In a pressure cooker. Which explodes.

This may just be me, but I'm allergic to shiitake mushrooms; they make me break out in a painful rash when I have them. And that's roughly the same reaction I have to the XML Document Object Model. Funny that.

And in conclusion: I really like Japanese food and object-oriented programming -- but if these were all there were to fine food and proper programming, I'd give it all up and go flip burgers.


2001-06-24   sburke