• dariusj18@lemmy.world
    link
    fedilink
    arrow-up
    16
    ·
    2 months ago

    The number one thing that gets in my way of refactoring to function is figuring out what to name the functions takes too long.

    • Victor@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      2 months ago

      Then perhaps the code you are trying to extract doesn’t make a clear and cohesive procedure. Maybe include more or less of the code, or rework the code into logical pieces or steps. Write the algorithm in human language first, then implement the steps using functions.

      🤷‍♂️ Or fnck it.

    • Skull giver@popplesburger.hilciferous.nl
      link
      fedilink
      arrow-up
      3
      ·
      2 months ago

      Maybe this will be the biggest contribution AI will do for programmers: figure out good names. I should try that some time!

      On the other hand, AI will only generate output as good as its input, and most large code projects (including Linux) are terrible at naming things.