• 0 Posts
  • 3 Comments
Joined 1 year ago
cake
Cake day: June 17th, 2023

help-circle

  • I haven’t read the study, but most of these would need a placebo group, so divide the herd into thirds, one with no paint, one with stripes, and one fully painted white to get a baseline for each group. Also would be good to randomize which group each cow goes in each day so to rule out one cow who is especially tasty to flies.


  • The code on the left is more readable. It is easy to follow and see what is happening at each step.

    That being said, the code on the right is easier to maintain. If the requirement comes down the pipe that we now need to support a new pizza topping it is easy to jump to the add toppings method using the IDE instead of scanning the entire monolith procedural function. Or if we now need to add support for take-and-bake, we can just modify the small entry method.

    This also assumes that we are not needing to reuse any of these methods. If you want to add toppings to a sandwich or a salad, better write another huge method like the one on the left, or add a ton of nested if/else or switch statements. If you use the style on the right you can reuse the add toppings method without worrying about if you should preheat the oven for a salad.

    The author chose a very simplistic requirement for an example and it is all well and good until you let it fester in a code base for ten years, with multiple interns maintaining it and end up with a huge spaghetti code monster to deal with.