The AuthenticationFairy

by Curtis Poe

I was discussing object oriented (OO) programming with someone who was working on a horrible piece of software with class names like StartSession. I'll call him "Alice". Naturally, when wading through these classes, he finds 400 line "methods" in classes which are merely OO façades around procedural modules. This is disappointing, but it's all too common. If you think that StartSession is a good name for a class, someone has done a poor job of teaching OO to you.

I think part of the problem is that while there are some excellent university professors who do a fantastic job of teaching OO, many professors I took classes from had little to no real experience outside of the classroom, or those with experience clearly went back to teaching due to the old adage "those who can't, teach". Surprisingly, two of the best instructors I had were teaching COBOL. Both of them clearly had decades of real-world experience under their belts and it showed in the classroom. They understood their material, they understood the pitfalls, and taught us how to work within the constraints of the language.

Getting back to Alice, he told me about an idea he once implemented to make it clear to other programmers that OO classes can be thought of as responsible agents. One of the first classes he wrote for his work was named the AuthenticationFairy.


2007-03-24 08:46:14
I agree on the object relational mappers with you 100%. That's why I chose iBatis. It works with result sets, not tables. New field name or moved field. Only change the underlying queries, code stays the same.
2007-03-24 12:01:53

You mention a dog class is bad because it really isn't real world and so I did "perldoc perlboot" and what do I find:

sub Cow::speak {
print "a Cow goes moooo!\n";

sub Horse::speak {
print "a Horse goes neigh!\n";

sub Sheep::speak {
print "a Sheep goes baaaah!\n"


Now, I understand why but I thought it a little funny.

2007-03-24 12:04:10
I want to follow up and say...yes I agree with you as well.
2007-03-24 14:30:56
was working on a horrible piece of software with class names like StartSession.


That sounds like a C programmer who started writing in C++ without understanding objects. An all too frequent occurrence.

2007-03-24 17:23:22
I completely disagree with you about ORMs, of course, I don't believe in Enterprise databases (that is to say, I think they are magical creatures, quite unlike AuthenticationFairies), so it's not a problem in my world.
2007-03-25 04:29:36
Danno: for the record (no pun intended), I do like ORMs and I find them extremely beneficial. However, there are some pretty serious trade-offs with many of them and regrettably, since most developers don't understand databases, they don't understand the trade-offs. It's only in understanding the limitations of ORMs can we make reasonable decisions about their use.
Roger Nolan
2007-03-25 12:03:42
Nice article but tell me that you don't take yourself seriously enough to type the cedilla in fa├žades.
2007-03-26 08:13:05
I would argue that puppy is not an instance of dog, but it is a class of its own, preferably a subclass of dog. (house_broken = false; cuteness += 10;) Fido would be an instance.
Johan L
2007-05-17 02:51:46
See also: The Tell, Don't Ask principle

2007-10-12 17:48:33
If we couldn't map a table to an object how could we work with database and objects?