this post was submitted on 10 Aug 2024
100 points (100.0% liked)

Programming

420 readers
11 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
 

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
[–] magic_lobster_party@kbin.run 5 points 1 month ago (1 children)

What I’m saying is that it’s hiding too much of the control flow.

Compare it with this code:

public double calculateCommision(Sale sale, Contract contract) {
    double defaultCommision = calculateDefaultCommision(sale);
    double extraCommision = calculateExtraCommision(sale, contract);
    return defaultCommision + extraCommision;
}

This is about the same number of lines, but it communicates so much more about the control flow. It gives us an idea which data is involved in the calculations, and where we can find the result of all the calculations. We can make assumptions that the functions inside are independent from each other, and that they’re probably not relying on side effects.

This is also against clean code examples, because Uncle Bob seems to be allergic against function arguments and return values.

[–] kogasa@programming.dev 1 points 1 month ago

You're making assumptions about the control flow in a hypothetical piece of code...