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

  • magic_lobster_party@kbin.run
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    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.