Smash Company Splash Image

February 10th, 2016

In Technology

2 Comments

Why I hate all articles about design patterns

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

Sometimes play is a lie

Imagine two children, both nine years old, decide to play tea. They rummage around in the closets of their respective parents. They dress up as they’ve seen their parents dress up. The one goes over to the other’s house.

“Mr. Worthington, it is so nice to see you,” says the girl who is acting as host. “Would you like some tea?”

“Why, yes, Mrs. Kentworth, I would be delighted to have some tea.”

The host brings an empty cup of tea to the guest, and the guest pretends to sip at it.

“Why, Mrs. Kentworth, this is such delicious tea!” says the little boy.

“I am so glad you enjoyed it!” says the other little girl.

They talk about their imaginary house and imaginary kitchen.

They are imitating the manners of their parents. This is how children learn. And when children are so young, there is no harm in it. Rather, it is cute and somewhat comical.

For better and for worse, people continue to play when they grow up. This is fine so long as the play is labeled as play. Joyful play is the starting point of creativity. But play becomes dangerous when the people who are playing convince themselves that they are doing real work. If the play is driven by a desire to avoid a difficult topic, then whatever game the adults are engaged in is likely to be destructive to their long-term interests. And such play can be insidiously difficult to spot if the people in question are hyper-intelligent and able to come up with seemingly reasonable justifications for what they are doing.

Imagine two programmers who spend all day discussing Design Patterns. Their conversation sounds like this:

“Why, Mister Yi! How shall we normalize our data? Is Fifth Form enough, or do we need Sixth Form?” said one.

“Why, Mister Kerr! What a delightful question! I suggest the Strategy Pattern. Let’s make normalization levels a configurable, pluggable behavior!”

They are playing.

I once worked at a small startup where the CTO and his buddies were working on a website that gave nurses a way to track patients medical information. When I first spoke with them, I was dazzled by their intellect. I recall our first conversation lasted 4 hours, during which we covered dozens of important topics: how many unit tests are enough, the trade-offs to be made when invalidating a cache, optimizations of TCP, the right length for Git commit messages, when to rebase, the advantages and disadvantages of polyglot programming, how to resolve inconsistency in a distributed database after a network partition, and so on.

Once I started to work with them, my impression of them changed. We had fantastic conversations but we were getting very little work done. Also, they were doing some unusual things, such as storing JSON strings in a text field in a PostGres database. They had done this before PostGres supported JSON. They had begun work in 2011, but they rejected all of the existing document databases (such as MongoDB or Riak). In 2013 they decided to work on version 2.0 of their software, which would be a complete re-write, but they decided to continue to keep JSON strings in PostGres. They liked some of the Python libraries that they had been working on, and they wanted to continue working on them. They were not even adapting to the fact that PostGres had begun to support JSON natively!

Was the work justified, or were they simply engaged in a hyper-intelligent kind of goofing off? This was for a website that was a fairly straightforward CRUD app. They could have used an existing framework (Django, Rails, Symfony, etc), which would have allowed them to develop much faster, and which already had many of the tools they were building. They had spent years doing work which should have only taken a few weeks. But using other people’s code to build a CRUD app is not fun.

Fun is important, because we should all have some fun at work, but at the same time, they were just sort of goofing off, adding in a thousand tasks which they felt were fun, and which let them avoid doing the work which the business actually needed.

Play at work falls into two types:

1.) Learning

2.) Avoidance

The first good, the second is bad. The kind of play that helps foster a deeper understanding of the craft of software is a good thing. But if a team is playing just because they are avoiding some difficult issue about their business model, or they want to avoid talking about their own perfectionism, then that is a real problem.

At the startup, where I worked in 2014, the team was consumed with its own perfectionism. In a sense, they were undone by their own competitive pressures. They admired each other, and they each wanted to win even more admiration from each other, so they were constantly doing complex things that earned real respect from any software engineer who heard about their exploits. But none of it had anything to do with the needs of the business.

I’ve worked for more than one client like this. I sometimes feel some frustration at what seems like too much emphasis on theoretical concerns. In urgent situations, I often suggest we cut a few corners so as to get some important work done. So, I sometimes say that I hate all articles about theoretical subjects such as Design Patterns. Too much theory!

But obviously that isn’t entirely true. My best known essay is “Object Oriented Programming Is An Expensive Disaster Which Must End“. Having invested thousands of hours into studying these topics, we all feel there must be some importance to them.

What is the real point of discussing theoretical issues? I write these essays because I want to write software in the most simple and direct way that I can, while still achieving the safety and reliability that the software needs. That is, I want to be more productive. I feel that discussing theoretical issues can be justified, especially if the articles give advice that really help developers get work done.

Get work done. In this I feel most articles about Design Patterns fail.

Perhaps I’m being unfair to Design Patterns, but those articles seem like the worst kind of tech writing, the most likely to inspire useless discussion that doesn’t help move a team forward. Catering to software developers perfectionism tends to be bad for business. And this particular type of article seems to be the most extreme in that regard.

We should all be on guard against the kinds of discussion that waste time without actually helping us advance the craft of software.

Source



Check out my book:





RECENT COMMENTS

July 15, 2018 3:17 pm

From Anonymous on Friendly, intelligent flash cards?

"Good to know that I wasn't too late :)..."

July 15, 2018 8:32 am

From lawrence on Friendly, intelligent flash cards?

"Thank you for these comments regarding Anki. It sounds useful. I can imagine having the full context of the se..."

July 15, 2018 6:32 am

From Anonymous on Friendly, intelligent flash cards?

"Anki limits how much you review. I have 10000+ cards across my decks but the program arranges them in such a w..."

July 6, 2018 3:42 pm

From lawrence on Docker is the dangerous gamble which we will regret

"RK, your comment is irresponsible and pure FUD. These technologies are not being deprecated. Some of them have..."

July 5, 2018 10:21 am

From RK on Docker is the dangerous gamble which we will regret

"Deprecation warning: The Packer, Artifact Registry and Terraform Enterprise (Legacy) features of Atlas will no..."

June 25, 2018 11:58 am

From Barry Jones on Docker is the dangerous gamble which we will regret

"Solid read. I will say that it seems like there is a lot of momentum growing around Ansible these days. It see..."

June 21, 2018 11:25 pm

From Anon on Docker is the dangerous gamble which we will regret

"Thank you for this. Sometimes I feel like I'm living in a bizarre, pro-Docker for everything world. I am prima..."

May 30, 2018 4:35 pm

From Thomas on Docker is the dangerous gamble which we will regret

"Thank you for this beautifully written and relevant piece. I think it has saved me a whole world of pain. ..."

May 29, 2018 10:46 am

From lawrence on Docker is the dangerous gamble which we will regret

"Andrew Reilly, thank you for writing. You make several good points, especially this: "Also an extra layer o..."

May 28, 2018 11:17 pm

From Andrew Reilly on Docker is the dangerous gamble which we will regret

"Nice article, thanks! I think that it's interesting to also look around at the problem from a greater dista..."

May 21, 2018 2:39 am

From xulin on Docker is the dangerous gamble which we will regret

"Elixir & Erlang..."

May 16, 2018 3:28 pm

From Steffen on Docker is the dangerous gamble which we will regret

"I'll never regret the use of docker cause I never used it (and never will). My advise is the the anti docker ..."

May 15, 2018 1:36 pm

From Clayton Gulick on Docker is the dangerous gamble which we will regret

"Great article. The current Docker craze, imho, is the same old problem where engineers get a hammer and every ..."

May 15, 2018 10:38 am

From lawrence on Docker is the dangerous gamble which we will regret

"Yawar, yes, I have looked at Elixir. And as I mentioned in the article: "They are now examining Go and E..."

May 15, 2018 10:32 am

From lawrence on Docker protects a programming paradigm that we should get rid of

"Agam Brahma, thank you. I have now fixed the typo...."

2 COMMENTS

Pingback: New top story on Hacker News: Why I hate all articles about design patterns – Tech + Hckr News

March 5, 2018
12:21 am

By Soundararajan

You should immediately read the book “The Expert Beginner”.

Possibly your hate for design pattern originates from the hatred of your past.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>