#DEVDiscuss: Naming Things
Erin Bensinger

Erin Bensinger @erinposting

Joined:
Oct 19, 2020

#DEVDiscuss: Naming Things

Publish Date: Apr 25 '23
22 8

image created by Margaux Peltat for the Chilled Cow YouTube channel

Time for #DEVDiscuss — right here on DEV 😎

Inspired by @samuel-braun's Top 7 post, tonight’s topic is...naming things 😱


Questions:

  • Do you have a favorite naming pattern for variables?
  • What's the worst-named variable you've seen in the wild? Note: comments must abide by the Code of Conduct!
  • How do you feel about naming? Love it, hate it, indifferent?
  • Any triumphs, fails, or other stories you'd like to share on this topic?

Comments 8 total

  • Jean-Michel 🕵🏻‍♂️ Fayard
    Jean-Michel 🕵🏻‍♂️ FayardApr 25, 2023

    I take the iterative view: I choose the first non terrible thing that comes to mind, make things work, commit, look at my naming choices again, notice those that are lying and refactor them

    Also when naming something very important, I explicitly ask for feedback in the PR.

  • Thomas Broyer
    Thomas BroyerApr 25, 2023

    About naming things, I published a few weeks ago about SPA vs MPA, and their relation to CSR, SSR et al.

  • Ervin Szilagyi
    Ervin SzilagyiApr 25, 2023
    • Do you have a favorite naming pattern for variables?

    No, and probably you should not have one too. I recommend sticking to whatever the best practice is for your language/team/company etc.

    • What's the worst-named variable you've seen in the wild?

    Probably everything that is using Hungarian notation. (btw, I'm Hungarian, lol)

    • How do you feel about naming? Love it, hate it, indifferent?

    I'm indifferent.

    • Any triumphs, fails, or other stories you'd like to share on this topic?

    I've seen this in a code base:

    HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor -
    javadoc

    • Tiziano
      TizianoApr 26, 2023

      HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor

      That's so long it actually breaks the docs layout on mobile.

  • Chris Jarvis
    Chris JarvisApr 25, 2023

    Do you have a favorite naming pattern for variables?

    Personal projects Basic camel case and Noun Verb/adjective.
    Work or open source work follow their guidelines.

  • Raja Jaganathan
    Raja JaganathanApr 26, 2023

    Do you have a favorite naming pattern for variables?

    This cheatsheet will help some extend - github.com/kettanaito/naming-cheat....

  • Thibaut Andrieu
    Thibaut AndrieuApr 26, 2023

    What's the worst-named variable you've seen in the wild?

    • Seen this in production code:
    class Foo {
        struct Bar {
        }
    }
    
    Enter fullscreen mode Exit fullscreen mode
    • Who knows ?...
    bool isLoaded(){...}
    bool isReallyLoaded(){...}
    
    Enter fullscreen mode Exit fullscreen mode
    • "In a galaxy far away":
    long long timeAgo;
    
    Enter fullscreen mode Exit fullscreen mode
    • Any class ending with "Manager". They are always just a bunch of methods that do stuff.

    • I also have encountered that kind of pattern too many times...:

    Color red = #00ff00;
    int one = 2;
    string windowsVersion = "Ubuntu1804";
    float PI = 1.570;
    ...
    
    Enter fullscreen mode Exit fullscreen mode
  • Renan Cossenzo
    Renan CossenzoApr 26, 2023
    • Do you have a favorite naming pattern for variables?
      I like to follow c# coding conventions and always try to name anything with an explanation of what it means in the context

    • What's the worst-named variable you've seen in the wild?
      Hungarian notation (i've just found out what it is) and abbreviations (I mean: what does "r1" variable mean???)

    • How do you feel about naming? Love it, hate it, indifferent?
      I like naming. I think it is really important to be the most explicit as possible for other devs

Add comment