The He-Man Pattern Haters Club

Richard Mansfield has a bone to pick with object oriented programming:

Certainly for the great majority of programmers – amateurs working alone to create programs such as a quick sales tax utility for a small business or a geography quiz for Junior – the machinery of OOP is almost always far more trouble than it’s worth. OOP introduces an unnecessary layer of complexity to procedure-oriented design. That’s why very few programming books I’ve read use OOP techniques in their code examples. The examples are written as functions, not as methods within objects. Programming books are trying to teach programming – not the primarily clerical and taxonomic essence of OOP. Those few books that do superimpose the OOP mechanisms on their code are, not surprisingly, teaching about the mysteries of OOP itself.

I am skeptical of dogmatic adherence to OOP myself, but even I did a double-take while reading this article. Is it a parody? I don’t think so, considering he cites an entire website devoted to this subject.* But before (or at least until) you write Mr. Mansfield off as a kook, consider his background:

Richard Mansfield has written 32 computer books since 1982, including bestsellers ‘Machine Language for Beginners’ (COMPUTE! Books) and ‘The Second Book of Machine Language’ (COMPUTE! Books). From 1981 through 1987, he was editor of COMPUTE! Magazine and from 1987 to 1991 he was editorial director and partner at Signal Research.

This is a guy who has written a lot of code. While his opinion veers awfully close to religion, I wouldn’t disregard it altogether. Too many people accept patterns as gospel, so I think a little counter-programming is healthy.

On the other hand, if you think the Gang of Four is as cool as, well, the Gang of Four, then you may be interested in this retrospective on Design Patterns, with comments from a variety of developers.

Ten years have passed since Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (aka the Gang of Four or GoF) wrote and published Design Patterns: Elements of Reusable Object-Oriented Software. And while most programming books that old are as pass as the technologies they covered or required second and third editions along the way, the GoF’s seminal work still flies off bookshelves, despite being the same text that debuted in the fall of 1994 – an eon ago in Internet time.

One interesting fact: the most commonly cited patterns were Singleton, Factory, Observer, and Command.

I’m currently reading Head First Design Patterns, which is basically Design Patterns for Dummies. It’s a good read. But I still feel patterns are more useful as a common design vocabulary than as actual implementation models. It’s kind of damning that even the radically simplified pattern examples in the book are far more complicated than they need to be. Would I really design a point of sale system that used the Decorator pattern to represent coffee pricing? I think I’d use a simple relational database table and some procedural code. If I needed to add a topping, I’d simply add a record to the table – no complex objects or inheritance models required.

*As Damien Katz points out, this is the website of a “a megalomaniac nut named Bryce Jacobs,” not the article’s author.

Related posts

Complaint-Driven Development

If I haven’t blogged much in the last year, it’s because we’ve been busy building that civilized discourse construction kit thing I talked about. (Yes, that’s actually the name of the company. This is what happens when you put me in charge of naming things. Pinball

By Jeff Atwood ·
Comments

The Rule of Three

Every programmer ever born thinks whatever idea just popped out of their head into their editor is the most generalized, most flexible, most one-size-fits all solution that has ever been conceived. We think we've built software that is a general purpose solution to some set of problems, but

By Jeff Atwood ·
Comments

Today is Goof Off at Work Day

When you're hired at Google, you only have to do the job you were hired for 80% of the time. The other 20% of the time, you can work on whatever you like – provided it advances Google in some way. At least, that's the theory. Google&

By Jeff Atwood ·
Comments
Coding Horror: The Book

Coding Horror: The Book

If I had to make a list of the top 10 things I've done in my life that I regret, "writing a book" would definitely be on it. I took on the book project mostly because it was an opportunity to work with a few friends

By Jeff Atwood ·
Comments

Recent Posts

Stay Gold, America

Stay Gold, America

We are at an unprecedented point in American history, and I'm concerned we may lose sight of the American Dream.

By Jeff Atwood ·
Comments
The Great Filter Comes For Us All

The Great Filter Comes For Us All

With a 13 billion year head start on evolution, why haven’t any other forms of life in the universe contacted us by now? (Arrival is a fantastic movie. Watch it, but don’t stop there – read the Story of Your Life novella it was based on for so much

By Jeff Atwood ·
Comments
I Fight For The Users

I Fight For The Users

If you haven’t been able to keep up with my blistering pace of one blog post per year, I don’t blame you. There’s a lot going on right now. It’s a busy time. But let’s pause and take a moment to celebrate that Elon Musk

By Jeff Atwood ·
Comments
The 2030 Self-Driving Car Bet

The 2030 Self-Driving Car Bet

It’s my honor to announce that John Carmack and I have initiated a friendly bet of $10,000* to the 501(c)(3) charity of the winner’s choice: By January 1st, 2030, completely autonomous self-driving cars meeting SAE J3016 level 5 will be commercially available for passenger use

By Jeff Atwood ·
Comments