Very funny quote on object-oriented design…

Imagine if the Perl cafe and Javahut were across the street from each other.

You walk into Javahut, and ask to sit down. “I’m sorry,” says the person at the door. I’m not actually the hostess, I’m a Factory class that can give you a hostess if you tell me what type of seat you want.”

You say you want a non-smoking seat, and the person calls over a NonSmokingSeatHostess. The hostess takes you to your seat, and asks if you’ll want breakfast, lunch, or dinner. You say lunch, and she beckons a LunchWaitress.

The LunchWaitress takes your order, brings over your food, but there’s no plates to put it on because you forgot to get a CutleryFactory and invoke getPlates, so the Waitress throws a null pointer exception and you get thrown out of the place.

–James Turner

I found this, along with many other great quotes, on fawcett’s main page. I can tell already I will be borrowing many of the quotes from this page for my personal weblog’s quote plugin. Most of them are just plain hilarious.

For the Perl fans out there… I assume the remaining part of the quote talked about how great Perl is (since the Perl cafe was mentioned as an alternative)…

What it doesn’t tell you, though, is that all these specific Java classes would be invisible to the person visiting the Javahut because they would all be just implementations of generic interfaces (IHostess, IWaitress, etc). So, yes, the above happens, but you would never know all these details. Still, very funny.

So, does object-orientation model the real world? I think the Olive Garden uses this very same toolkit.