• PotatoesFall@discuss.tchncs.de
    link
    fedilink
    arrow-up
    13
    ·
    13 hours ago

    It always blows my mind that people actually watch these terrible content creators. Like how could anybody watch this guy or MrBeast and not immediately realize it’s a shitty person. Not to mention the actually dogshit quality of the content to begin with lmao

    • ZILtoid1991@lemmy.worldOP
      link
      fedilink
      arrow-up
      9
      ·
      11 hours ago

      Once I watched a Mr. Beast video on Twitter, my reaction to it was that it’s slop, way before the term was associated with genAI.

    • ZILtoid1991@lemmy.worldOP
      link
      fedilink
      arrow-up
      91
      ·
      1 day ago

      PirateSoftware doesn’t use enums for whatever reason, instead he uses raw integer values with hand comments (and allegedly an Excel doc) on what is what, which is one of the reasons behind his awful code, which in turn lead to him not being able to ship his game.

      • Err(()).unwrap()@lemmy.world
        link
        fedilink
        arrow-up
        149
        ·
        1 day ago

        Actually they’re only enums if they’re made in the Enümmär region of Germany, otherwise they’re just sparkling integers.

        • ZILtoid1991@lemmy.worldOP
          link
          fedilink
          arrow-up
          14
          ·
          1 day ago

          Another comment on this post have declared enums outside of Rust being bad for not having tagged union capabilities.

          • calcopiritus@lemmy.world
            link
            fedilink
            arrow-up
            3
            ·
            edit-2
            3 hours ago

            That’s just someone that doesn’t know why people say things, so just made it up.

            Enums outside of rust are indeed bad (I would correct it to enums in every language I know that is not rust, since maybe some other do the same thing as rust). But it’s not because the tagged union thing.

            The problem of enums in other languages is that they do not make for a distinct type. They are just integers in a name. Or at least that is the case for C and Java enums. Python and JavaScript do not even have enums, which is even worse.

            When enums are just integers, you don’t know if a variable of the type of the enum is actually one of the variants of the enum. If you assume that, you can easily get into undefined behavior/crash territory quite fast.

            When making a library in C, for example, if one of your functions has an enum as a parameter, one of the first things you have to do is check if that parameter is actually in the range of the enum. Since you don’t control the caller to your function. These checks don’t belong in code at runtime, they belong to compile time, as you’re just validating the type of a variable.

            In rust, switch/match statements need to cover every single enum variant (of course, you can also have default paths to not cover every case) your code just won’t compile if you don’t. Which means that when you add a new variant to an old enum, you don’t have to go hunting every match statement to see if it affects your new change. That is a tedious and error-prone task if done manually, while it is pretty simple for the compiler.

            Of course, now that these differences are established, the tagged union thing comes in and makes rust ones better. The reason other language enums are bad is because they’re named integers, the reason rust’s are good is because they are tagged unions, completing the algebraic type system.

            • gluestick@lemmy.zip
              link
              fedilink
              arrow-up
              1
              ·
              3 minutes ago

              PHP enums can be backed by integers or strings but are distinctly typed and any signature that types them will be fatal even if the value matches that of a backed enum.

            • fruitcantfly@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              2 hours ago

              The problem of enums in other languages is that they do not make for a distinct type. They are just integers in a name. Or at least that is the case for C and Java enums. Python and JavaScript do not even have enums, which is even worse.

              Strongly typed enums is hardly unique to Rust.

              C++ has had them for a long time, for example: Using a plain integer type where an enum is expected has been prohibited since at least C++98. You can still use an enum in the place of an int, unless you use scoped enums (C++11 or later), which also require an explicit cast to convert from enum to the underlying type.

              And Python has had some form of enum since since 3.4: https://docs.python.org/3/library/enum.html. It’s not a language level feature, but that probably wouldn’t make much of a difference, and it’s as type safe as anything else in the language. But you will get a error when using type-hints, if you pass the wrong type to a function expecting an enum:

              from enum import Enum
              
              class MyEnum(Enum):
                  A = 1
                  B = 2
              
              def foo(_: MyEnum): ...
              
              foo(1)  # error: Argument 1 to "foo" has incompatible type "int"; expected "MyEnum"  [arg-type]
              
            • JackbyDev@programming.dev
              link
              fedilink
              English
              arrow-up
              3
              ·
              edit-2
              5 hours ago

              The problem of enums in other languages is that they do not make for a distinct type. They are just integers in a name. Or at least that is the case for C and Java enums.

              This is not the case for Java enums.

              • calcopiritus@lemmy.world
                link
                fedilink
                arrow-up
                2
                ·
                3 hours ago

                Yeah, my bad. Long time I don’t use java and miss remembered. Apparently proper java enums exist since 2004.

          • RaphaelSchmitz@feddit.org
            link
            fedilink
            arrow-up
            15
            ·
            1 day ago

            Yeah but that’s just edgelord behaviour.

            You get those a lot with all kinds of programming languages, and Rust is certainly not know for having less of them.

        • Echo Dot@feddit.uk
          link
          fedilink
          arrow-up
          20
          ·
          edit-2
          1 day ago

          He’s some apparently famous YouTuber who reckons that he’s a programming genius even though I’m the better programmer than him.

          Occasionally he does something stupid and pops up on everyone’s radar for a while and then the rest of the internet goes back to forgetting about him.

          I guess he’s kicked off again.

          • SkyezOpen@lemmy.world
            link
            fedilink
            arrow-up
            13
            ·
            23 hours ago

            He’s actually been doing stupid shit for ages, it just didn’t get widespread attention until the SKG thing blew up. Actually the wow roach might’ve been before that, but either way SKG is what basically ended him.

          • lobut@lemmy.ca
            link
            fedilink
            arrow-up
            4
            ·
            23 hours ago

            famous YouTuber who reckons that he’s a programming genius

            Is that true? I’ve seen a lot of his shorts and he’s always been like: “just make games” – “stop worrying about code quality, some amazing games have shit code”

            • Echo Dot@feddit.uk
              link
              fedilink
              arrow-up
              3
              ·
              13 hours ago

              He also threw a massive tantrum when somebody reviewed his code and said it wasn’t the quality of somebody who works in the industry, which he claims to have done.

              • lobut@lemmy.ca
                link
                fedilink
                arrow-up
                1
                ·
                edit-2
                5 hours ago

                I saw a clip of Primeagen saying that Casey Muratori said that Pirate’s stuff was fine?

                Like, I hate Thor’s stance on SKG for sure. However, I steered largely away from this drama because I think a lot of criticisms feels unrelated. I didn’t see the tantrum but people were going after him quite a lot and if you told him you don’t think he belongs in the industry maybe that’s a reason to throw one?

                I generally don’t care. I have a few friends in the industry and they say a lot of the code is shit in general for games – so I don’t particularly care. If Pirate was a guy saying that you need to follow clean code and all that jazz then that’d make sense, I suppose. Which is why I’m on Uncle Bob’s case :P but I’m not jumping on the bandwagon for this one against Thor.

      • vrek@programming.dev
        link
        fedilink
        English
        arrow-up
        36
        ·
        edit-2
        1 day ago

        Reminds me of a codebase I used to work on which we had 899 variable limit and we couldn’t name them, only number them. These were limitations of the language.

        Each variable had to be assigned a 3 digit number but 1-100 were taken by internal stuff so only 101- 999 was allowed. So let’s say you wanted to check if power was between 50 and 60 you would end up with like

        #301 = 50;

        #302 = 60;

        #303 = powerSignal;

        If #303 < #301 || #303 > #302: Display error

        Continue process

              • vrek@programming.dev
                link
                fedilink
                English
                arrow-up
                19
                ·
                1 day ago

                Basically we made devices which were surgically implanted into your body to send specific electrical signals to your spine and brain for certain medical issues. The electronics were in a metal case so your icky blood and bodily fluids didn’t cause shorts. This system was to weld the metal case closed.

                • MajorasMaskForever@lemmy.world
                  link
                  fedilink
                  English
                  arrow-up
                  8
                  ·
                  1 day ago

                  Sounds like someone wanted to avoid needing to recompile for the target, but was either hardware constrained on what they wanted to do or as they thought that implementing their own language was going to be easy, learned it’s very much so not, and then took some stupid shortcuts

                  I totally haven’t done that myself, nope…

          • vrek@programming.dev
            link
            fedilink
            English
            arrow-up
            7
            ·
            1 day ago

            Lol, yup. Actually it was 4 axis. And connected to a laser instead of a milling bit. The system was also in a controlled gas environment which added extra complications.

            • TonyOstrich@lemmy.zip
              link
              fedilink
              arrow-up
              3
              ·
              1 day ago

              Ooh, sounds spicy.

              The hard set limit of #500-#999 is really frustrating when you also have to be careful not to overwrite certain kinds of “standard” program variables that your shop or company has decided on. I’m generally pretty OK with the limitations of these controllers and G-Code in general, but I would fucking kill to be able to use an array or to be able to declare a variable 😭.

              • vrek@programming.dev
                link
                fedilink
                English
                arrow-up
                1
                ·
                23 hours ago

                It was mostly just the naming that caused my frustration. I tried to declare all variables at start, had that section printed out and hung on my cubicle wall.

          • vrek@programming.dev
            link
            fedilink
            English
            arrow-up
            10
            ·
            1 day ago

            It was g-code which as another commentator correctly pointed out was used to control a fanuc cnc system.

          • vrek@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            24 hours ago

            It was a lot of magic numbers, why was that set that thing set to 3 minimum? It worked good enough at 3 to be acceptable

        • SkyezOpen@lemmy.world
          link
          fedilink
          arrow-up
          5
          ·
          edit-2
          16 hours ago

          It was for an ARG. Or it doesn’t matter because it runs on a smart fridge (no it doesn’t). Or he was OOM.

      • drcobaltjedi@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        1 day ago

        I mean thats not uncommon in game dev from what I have seen. Remember VVVVVV? The creator open sourced the code years ago, and they didn’t use enums either, just switch statements with integers. I imagine a lot of indie games suffer from this as they’re made by a passionate person/group that are learning on the fly.

        • ZILtoid1991@lemmy.worldOP
          link
          fedilink
          arrow-up
          6
          ·
          23 hours ago

          TBH sometimes I’m also guilty of this, if I forget about them. In one library on mine, I’ll have to put all error codes under a single enumerator, so I don’t need to make new ones every time I add functionality.

      • RaphaelSchmitz@feddit.org
        link
        fedilink
        arrow-up
        11
        ·
        1 day ago

        Not a problem, ignore the edgelording, you’ll be fine.

        A lot of people don’t understand that readability is about how fast someone can correctly understand that whole class/file/etc afterwards. Sometimes using enums improves that, sometimes not.

        For enums specifically, it is good to be aware what you do with them. Often it directly maps to a decision. E.g. enum ExportType with values JSON/XML/CSV - instead of passing an enum value to a big function with 3 different paths, you could have 3 classes that have a common interface, and pass one of those to the function to use. That is nicer sometimes, other times not.

        Another thing is that enums are often used to have a small INT DB column, which is not supposed to represent a number (like for math and stuff) but different options. In that case, yeah enum is perfect to describe in code what those numbers actually mean.

        But yeah, it all comes down to: After you write it, look at your code and see if it makes sense quickly - if not, adjust.

      • ZILtoid1991@lemmy.worldOP
        link
        fedilink
        arrow-up
        10
        ·
        1 day ago

        Enums in Rust are spicier unions, and Rust boosters like to paint it as the perfect way to do it, because it’s the best language ever, with no faults. If you disagree, they’ll try to frame you as a Lunduke fan and a bigot.

        • RustyNova@lemmy.world
          link
          fedilink
          arrow-up
          6
          ·
          1 day ago

          Never said that. In fact, enums have lots of issues that can add a lot of boilerplate code.

          But actually having data associated with the type system instead of just a flag is a lot more powerful and less prone to errors than classic enums

          You can also put functions on this union type that allows easy abstraction of what state the union is in

        • Johanno@feddit.org
          link
          fedilink
          arrow-up
          1
          ·
          1 day ago

          Iffind rust interesting but I don’t use it enough to know anything deep about it.

          All I know is that I am not made for c++.

          Hell I can’t keep track of pointers and scopes. And who the hell made templates?

          • ZILtoid1991@lemmy.worldOP
            link
            fedilink
            arrow-up
            1
            ·
            1 day ago

            Templates outside of D are a mess, and the reason why metaprogramming has a bad name. Templates inside D are easy to use, and its attempt at it is something more language should copy.