110
Linear code is more readable (blog.separateconcerns.com)
you are viewing a single comment's thread
view the rest of the comments
[-] coloredgrayscale@programming.dev 2 points 1 year ago* (last edited 1 year ago)

Think of it more like bigger building blocks rather than single use functions. If there is an issue with the pizza arriving burnt black at the customer you don't want to read through the logic for making the dough and adding toppings if the most likely cause is the oven.

Sure, you could add comment blocks to mark the sections. But you can't easily jump to that exact point. With function names you can easily skim over the unimportant calls, or go through a list of functions/methods in the file and jump there directly. With comments that's not a standard feature in IDEs.

Also that function does not scale well if you have more than 2 options of toppings. Maybe some are not compatible and logic needs to be added that you don't use pineapple and banana on the same pizza, for example.

But I understand your argument about following through multiple layers of abstractions. That's something that irritates me as well a bit, if you follow a function, that does nothing, but pass the same parameters through another function and return the result.

No guard clauses, or changes to the data, just 1:1 pass-through. And this them goes 2-3 levels deep before reaching real code again. Bonus of they all are in different files too.

this post was submitted on 15 Sep 2023
110 points (89.9% liked)

Programming

17314 readers
186 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