• NotAViciousCyborg@lemmy.world
    link
    fedilink
    arrow-up
    10
    ·
    2 months ago

    Exactly what I would do if I had to reuse it, especially now since I know that adding a package would actually add 2. It all just seems so…inefficient

    • kevincox@lemmy.ml
      link
      fedilink
      arrow-up
      11
      ·
      2 months ago

      Even if the code isn’t reused adding names to sub-expressions can be very valuable. Often times I introduce new functions or variables even if they are only used once so that I can give them a descriptive name which helps the reader more quickly understand what is happening.

      • NotAViciousCyborg@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        2 months ago

        Yeah, I do that with pretty much every separate operation in c# since our solutions are pretty big. Most of my JS scripts are just done in ServiceNow which are separated and named appropriately.