zakirullin / cognitive-load

🧠 Cognitive Load is what matters
Creative Commons Attribution 4.0 International
5.26k stars 114 forks source link

Add 'Abusing DRY principle' section #12

Closed erni27 closed 1 year ago

erni27 commented 1 year ago

This PR adds 'Abusing DRY principle' section.

erni27 commented 1 year ago

@zakirullin: I really appreciate what you did. You covered a lot of things developers find really hard to understand in so concise and easy to read way. I wish I had something similar at the beginning of my journey.

When I was reading this handbook I immediately thought of DRY. So fundamental principle but overused increases cognitive load a lot.

I hope you will forgive me for not submitting the issue first but I think we can have more valuable discussion if the text is already written. Please let me know if the proposed section inlines with your idea about this handbook.

zakirullin commented 1 year ago

Oh, really, that idea fits the handbook so much!

Some time ago I was sending this article to people obsessed with DRYiness.

Now we can use your well-writen section, which explains things so neatly.

Bravo, such a nice contribution! 👏

erni27 commented 1 year ago

Great to be a part of this. Thanks!

Yep, it is really hard to discuss with someone who is crazy about DRY. On the other hand, I can't judge them. It was literally the first principle I learnt as a programmer. Over the years I figured it doesn't have to be necessary a good thing. Unfortunately many times the hard way.

Everything is like that. Abuse can change the best thing into the worst one and balance comes from the experience and maturity. Hopefully someone would learn from our mistakes. 👨‍🦯

zakirullin commented 1 year ago

@erni27 Just letting you know that your section was discussed out loud here: https://www.ivoox.com/en/it-s-not-that-complicated-audios-mp3_rf_109193453_1.html

People love it! 👍

erni27 commented 1 year ago

@zakirullin: Thanks for letting me know! It seems like the handbook is on fire. 🔥 That's really good, the world should know about it. 💪

zakirullin commented 1 year ago

@erni27 https://news.mailings.appliedgo.net/x4i4i8w7o3/?utm_source=appliedgo-twitter

They mentioned DRY as well :)

It's seems like this paper gets attention by the Go community :)

erni27 commented 1 year ago

@zakirullin: I consider myself a 'Gopher' so good to know other Gophers are excited about this handbook too. 💪 Also, not sure if you've seen it but Rob Pike once gave a talk about 'Go Proverbs'. The quote in the DRY section is actually from that talk. He covered a lot of things there. Although it has 'Go' in title, it is really insightful for any programmer. 'Go Proverbs' by Rob Pike: https://youtu.be/PAAkCSZUG1c.

I was thinking also about adding two more sections.

  1. 'Good abstractions are discovered, not invented' - this one is actually implicitly mentioned in 'Abusing DRY' and 'Hexagonal/Onion architecture' sections but anyway I think it deserves a few words.
  2. 'High performance madness' - we are trying to be smart so we end up writing a lot of (unneeded) optimisations. High performance doesn't come from air, it comes from the complexity increasing cognitive lead. In 99% cases, this is not needed. We should aim for the correctness and simplicity first. And optimise only if it really brings a value (and the need is proved by thorough benchmarks).

Let me know what you think about the ideas. We can discuss them deeper.

zakirullin commented 1 year ago

@erni27 Wow! Then we share a thing in common :) Go is my favourite language, it finally took C's place in my heart. Yes, I saw this talk, and I like it!

High performance madness

I liked this idea, I believe we should highlight this in the handbook, let's try! Issue