Member-only story

Single Responsibility Principle: Why Do People Still Defend This Garbage Idea?

Andrew Zuo
5 min readAug 15, 2021

--

A cargo cult field illustrating the main criticism of the SRP; it’s overused
Credit: Wikipedia Under CC Attribution 3.0 Unported

Single responsibility principle. Single, responsibility, principle. Single. Responsibility. Principle.

It should be obvious from that one line why I hate the single responsibility principle so much. But in case it isn’t here’s an entire article just elaborating.

It’s The Slogan

So recently we’ve seen some pretty questionable slogans. I mean there’s ‘defund the police’ and there’s ‘stop the vote’. Now obviously these quotes are both very political. I am not commenting on the politics of these quotes, only the meaning behind them.

So in both cases I get it 100%. I get that you don’t literally mean these things. They’re more like clickbait headlines for your cause. I get it. But at the same time… DO YOU REALIZE HOW STUPID YOU SOUND!?!

This is the same thing with the Single Responsibility Principle. I get that you don’t literally mean ‘single responsibility’. More like a ‘single category of responsibilities’. I believe the creator calls this ‘a single reason to change’.

But WTF, why do you call your architecture ‘single responsibility principle’? All this is going to do is confuse beginner programmers into thinking they need a million classes each doing a single thing and we have all seen examples of that.

There Is A Better Way

But you know, the beginners, they’ll do what beginners do. And eventually they will realize that the single responsibility principle is garbage. Well, maybe not directly. Maybe they’ll be filled with a sense of Stockholm syndrome. “It’s not the single responsibility principle. How could it be? Everyone praises it. It must be me misunderstanding the single responsibility principle.”

Which maybe I’d agree with if there was no alternative the the single responsibility principle. But there is. Just the other day I praised the Unix philosophy of ‘Do one thing and do it well’. I think it’s a great idea mostly because it’s not that prescriptive.

--

--

Written by Andrew Zuo

Join me on my language learning journey with Litany, a smarter SRS language learning app. Available on iOS apple.co/3rZyh9B and Android bit.ly/38qt9xW

Responses (105)

Write a response