• uniqueid198x@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    10
    ·
    edit-2
    1 year ago

    Both styles have advantages and disadvantages. Fully procedural code actually breaks down in readability after a certain length, some poeple suggest 100 or maybe 200 lines, depending on how much is going on in the function.

    Blanket maxims tend to to have large spaces where they don’t apply.

    Additionally, the place where the code on the right is more likely to cause bugs and maintainability issues is the mutation of the pizza argument in the functions. Argument mutation is important for execution time and memory performance, but is also a strong source of bugs, and should be considered carefully in each situation. We don’t know what the requirements for this code are, but in general we should recomend against universal use of argument mutation (and mutability in general).