145

Seeing that Uncle Bob is making a new version of Clean Code I decided to try and find this article about the original.

you are viewing a single comment's thread
view the rest of the comments
[-] FlorianSimon@sh.itjust.works 10 points 1 month ago

Six levels of abstractions, sure, if you have that many, you may want 6 functions. But that contradicts Martin when he's saying that there should be one line in an if, and everything more should be promoted to its own function. There's no way a programmer routinely writes code so terse that you get six levels of abstraction in a dozen of lines of code. Otherwise, Martin doesn't understand what an abstraction is.

Managing a stack in your head like a computer is very challenging as far as cognitive load is concerned. You don't want to jump all over the place. Otherwise, when you reach your destination, you end up forgetting what got you here in the first place.

This form of code fragmentation makes debugging an absolute nightmare, and finding sources of mutation absurdly frustrating. Good tooling can help you track where a variable is used and in which order mutations happen trivially in code in a single function. It's not as as helpful when it's spread all over the place. You can infer so much less statically if you follow Martin's advice.

I'm not advocating for 1000-lines functions here, mind you. When functions become too big, other challenges arise. What's necessary is balance, which Martin's book fails to teach.

this post was submitted on 10 Aug 2024
145 points (95.0% liked)

Programming

16984 readers
148 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS