HNHacker News
TopNewBestAskShowJobs

vlzdr

17 karma · joined May 7, 2023

My blog: https://vladimirzdrazil.com/
submissionscomments
vlzdr··on Ask HN: Could you share your personal blog here?
https://vladimirzdrazil.com
vlzdr··on Clever code considered harmful
I wouldn’t use such strong words, but you’re right. Not everything needs to be made for beginners. I keep remembering what Rich Hickey said that seems relevant:

We should not sell humanity short by trying to solve the problem of beginners in our stuff. We need to make things for people to use, and we need to teach people and trust people to be able to learn how to do that.

https://youtu.be/QCwqnjxqfmY?t=1914, https://youtu.be/QCwqnjxqfmY?t=2063

vlzdr··on Death by design patterns, or On the cognitive load of abstractions in the code
I fully agree with you. You mentioned that sometimes applying the DRY principle is a bad thing. Really, people often adhere to the DRY principle far too dogmatically.

It’s better to have some duplication than to end up with a wrong abstraction.

I like the AHA principle much more. It suggests:

  - Avoid Hasty Abstractions
  - Prefer duplication over the wrong abstraction because duplication is far cheaper than the wrong abstraction
I found it here: https://kentcdodds.com/blog/aha-programming.

The point about duplication being better than wrong abstraction is made here: https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction.

And the principle doesn’t suggest avoiding abstractions altogether. It’s really only about avoiding the hasty ones. Wait with the abstraction until you feel it’s necessary or when duplication itself becomes a problem. At that point, you’ll have a clearer understanding of how the abstraction should function.