The ActionDoer Anti-Pattern

As far as I know, I coined the word ActionDoer, but I’m sure I’m not the first person to object to the idea it represents to me. When someone takes a simple action like printing “hello world” to the console and wraps it in an object that performs that action—for no other reason than to pretend they are writing “object oriented” code—I call that object an ActionDoer. Its entire purpose is just to execute a script, to do an action. It is not in any real sense an object, but certain languages like Java force you to make everything an object. The language simply does not have functions. It has only methods of objects.

People probably had a reason for thinking this way, right? Who can say? I think the reason was that in 1995 everyone suddenly thought object oriented programming wasn’t just useful, but that it should supplant all other forms of coding. Thus we have the ActionDoer anti-pattern. We have objects that just encapsulate a script for no good reason. The Java language and its literature are so full of these things I can barely stand to look at it. Swing. God help us. If I never see code for a Swing GUI again it will be too soon.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s