• warlaan@lemm.ee
    link
    fedilink
    arrow-up
    14
    ·
    edit-2
    9 months ago

    The real naming fail is calling the class “GameManager”, still my number one pet peeve. With a class name as vague as that you would have to add tons of information into the variable name. (Also the class name begs for unorganized code. I mean name one function or variable that you could not justify putting into the “GameManager” class. After all if it’s managing the game it could justifiably perform any process in the game and access any state in it.)

    Once you put the first bool into a class with a name like AccessibilitySettings, calling it something like HighContrast is completely sufficient.

    • Meansalladknifehands@lemm.ee
      link
      fedilink
      arrow-up
      6
      ·
      9 months ago

      We’ve all been guilty of these mistakes, naming stuff is hard, structuring your project is hard, learning the grains of a language takes time. But comments like these are golden nugets, some might read this and think “oh yeah, this makes sense” and rethink their whole methodology of naming and structure. You might have pushed someone reading your comment, to think more about these things.

    • Snazz@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      9 months ago

      Unity actually gives any class with the name GameManager a special gear icon. You cant just forgo the cool gear icon!

      (Its not too terrible from an organizational standpoint because most of the scripts are attached to game objects. MonoBehavior is a component of GameObject. For instance, you’d never have player movement in the GameManager class, you would put it in the component class attached to the player character GameObject.)

      • warlaan@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        9 months ago

        you’d never have player movement in the GameManager class

        You want to bet? (Source: I teach game programming on a college level.)

        But yeah, your comment about the gear icon is sadly more true than people may realize. Game developers do questionable things. => Engine developers cater to people. => Students argue that if something is supported it can’t be that bad. Sometimes it feels like fighting windmills.

    • Dragster39@feddit.de
      link
      fedilink
      arrow-up
      4
      ·
      9 months ago

      With a class name as vague as that you would have to add tons of information into the variable name.

      Technically they did exactly that.

    • dan@upvote.au
      link
      fedilink
      arrow-up
      2
      ·
      9 months ago

      “Manager” classes often end up like “God classes”, just like how “Utils” classes end up with a bunch of random stuff in them.

      • warlaan@lemm.ee
        link
        fedilink
        arrow-up
        1
        ·
        9 months ago

        At my first job I was working on an MMO and we had a DatabaseManager class with 10k+ lines of code. Less than the first 200 lines actually used any of the members of that class.