• hstde@feddit.de
    link
    fedilink
    arrow-up
    71
    ·
    8 months ago

    This is something that can easily get refactored, because the purpose of alia the variables is right there in the name. This is way better that spending three days to try to figure out what the purpose of var1 is.

    • jballs@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      8
      ·
      8 months ago

      Nah, refactoring this would be a bitch. Your function name contains everything that happens in the function. Which means if you add something to it, you also have to change the name of the function. So CallThisWhenThePlayerTakesDamageAndIfThePlayerHealthIsLessThanZeroThenAlsoTheyDie would have to go to something like CallThisWhenThePlayerTakesDamageAndIfThePlayerHealthIsLessThanZeroThenAlsoTheyDieAndIncrementTheTotalDamageTakenCounter if you added something else.

    • 𝓹𝓻𝓲𝓷𝓬𝓮𝓼𝓼
      link
      fedilink
      English
      arrow-up
      6
      ·
      8 months ago

      oh such hope

      in a week IntegerThatTracksOneThingForOnePurpose will be an object tracking 30% of the game state and mutated in 15 places without ever being renamed