• CanadaPlus@lemmy.sdf.org
    link
    fedilink
    arrow-up
    51
    ·
    edit-2
    4 months ago

    I will confess that I get a sense of psychological comfort from strict typing, even though everyone agrees Python is faster for a quick hack. I usually go with Haskell for quick stuff.

    • BlueKey@fedia.io
      link
      fedilink
      arrow-up
      30
      arrow-down
      1
      ·
      4 months ago

      And then the quick hack gets a permanent solution and the next employee has to fight trough the spagetti.

        • CanadaPlus@lemmy.sdf.org
          link
          fedilink
          arrow-up
          3
          ·
          4 months ago

          I’d guess it’s less true for something statically typed, just because that reduces the ways it can be unintuitive.

          • NeatNit@discuss.tchncs.de
            link
            fedilink
            arrow-up
            2
            ·
            4 months ago

            I firmly believe that every language has an equal proportion of spaghetti code to clean code. The only factor that might screw with this is how much a language is used in industry, which I’d expect raises the ratio. However, there’s plenty of hobbyists writing spaghetti code too so I don’t think even that factor has much effect.

              • NeatNit@discuss.tchncs.de
                link
                fedilink
                arrow-up
                1
                ·
                4 months ago

                Okay, I’ll grant you brainfuck… As for assembly, I don’t think it’s inherently spaghetti. You can split it up into functions just like you can with an actual programming language. It’s not impossible to make structured code.

                That said, I never coded assembly outside of a mandatory university course, so I don’t feel super confident in saying that. But I don’t think of it as a programming language anyway - it’s a 1:1 translation to/from machine code, and machine code isn’t meant to make programming easy or scalable.

                • CanadaPlus@lemmy.sdf.org
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  edit-2
                  4 months ago

                  And TBF neither is brainfuck. It was a bit of a cheeky example, but I wanted to really emphasise the range of differences between languages, and language-like things.

                  I have trouble believing that every language is exactly as easy to organise code in. I’ll give you that it’s possible in every language (and assembly) to organise code, but that’s far too low a bar for practical measurement. Technically you can dig a ditch with a rusty spoon, too…

                  If Roller Coaster Tycoon had well organised code, that was down to way more effort being expended to make it that way.

                  • NeatNit@discuss.tchncs.de
                    link
                    fedilink
                    arrow-up
                    1
                    ·
                    4 months ago

                    I think we’re going to have to agree to disagree. If any project in any language has well-organized code, it’s down to a ton of effort.

                    Assembly is harder to code in, period. It’s even harder when your code is a total mess and you didn’t plan ahead. For a large assembly project to survive at all, some structure is as necessary as oxygen. And not to mention, there are far fewer projects written in assembly anyway.

                  • NeatNit@discuss.tchncs.de
                    link
                    fedilink
                    arrow-up
                    1
                    ·
                    4 months ago

                    Oh, and if you really want a tough language, try Malbolge. The ratio of structured code to spaghetti code in that one is 0:1 - there are 0 instances of non-spaghetti code, and 1 instance of spaghetti code. I refuse to believe there’s any more code other than the Hello World example.

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      30
      arrow-down
      5
      ·
      4 months ago

      I find Python is quick for the first 30 minutes. If you need any kind of libraries, or assistance from an IDE, or a distribution build, or you’re more familiar with another language, then it isn’t quicker.

      • zalgotext@sh.itjust.works
        link
        fedilink
        arrow-up
        19
        arrow-down
        3
        ·
        4 months ago

        If you need any kind of libraries

        PyPI has a huge selection of libraries

        assistance from an IDE

        PyCharm a super powerful IDE, VSCode has tons of Python extensions that L rival PyCharm’s functionality, lots of other IDEs have decent python support

        or a distribution build

        Not sure exactly what you mean by this

        or you’re more familiar with another language

        Yeah this can be said about any language. “You’re quickest in the language you’re most familiar with”. That’s basically a tautology.

        • Ephera@lemmy.ml
          link
          fedilink
          arrow-up
          24
          arrow-down
          3
          ·
          4 months ago

          Oh boy, you really wanna talk about it?

          PyPI has a huge selection of libraries

          It does, but the lack of static typing means it is more difficult to interact with foreign code (correctly).

          When I pull in a library in a JVM language or Rust etc., I quickly glance at the documentation to get a rough idea of the entrypoint for the library.
          Like, let’s say I want to create a .tar file, then the short “Writing an archive” example tells me all I need to know to get started: https://crates.io/crates/tar

          If I need to find out more, like how to add a directory, then having the tar Builder initialized is enough for me to just ask my code completion. It will tell me the other available functions + their documentation + what parameters they accept.
          If I make a mistake, the compiler will immediately tell me.

          In Python, my experience was completely different. Pulling in a library often meant genuinely reading through its documentation to figure out how to call it, because the auto-completion was always unreliable at best.
          Some libraries’ functions wouldn’t even tell you what types you’re allowed to feed into them, nor what type they return, and not even even diving into their code would help, because they just never had to actually specify it.

          PyCharm a super powerful IDE, VSCode has tons of Python extensions that L rival PyCharm’s functionality, lots of other IDEs have decent python support

          Yes, PyCharm is a super powerful IDE when compared to Nodepad++. But it’s a trashcan fire compared to IntelliJ or even the much younger RustRover.

          Half the time it can’t assist you, because no one knows what types your code even has at that point.
          The other half of the time, it can’t assist you, because, for whatever reason, the Python interpreter configured in it can’t resolve the imports.
          And the third half of the time, it can’t assist you, because of what I already mentioned above, that the libraries you use just don’t specify types.

          These are problems I’ve encountered when working on a larger project with multiple sub-components. It cost us so much time and eventually seemed to just be impossible to fix, so I ended up coding in a plain text editor, because at least that wouldn’t constantly color everything red despite there being no errors.

          These problems are lessened for smaller projects, but in that case, you also don’t need assistance from an IDE.

          or a distribution build

          Not sure exactly what you mean by this

          What I mean by that is that Python tooling is terrible. There’s five different ways to do everything, which you have to decide between, and in the end, they all have weird limitations (which is probably why four others exist).

          or you’re more familiar with another language

          Yeah this can be said about any language. “You’re quickest in the language you’re most familiar with”. That’s basically a tautology.

          Yes. That is all I wanted to say by that. People just often claim that Python is a great prototyping language, to the point where the guy I was responding to, felt they’re doing the wrong thing by using the familiar tool instead. I’m telling them, they’re not.

          • tyler@programming.dev
            link
            fedilink
            arrow-up
            6
            arrow-down
            1
            ·
            4 months ago

            What I mean by that is that Python tooling is terrible. There’s five different ways to do everything, which you have to decide between, and in the end, they all have weird limitations (which is probably why four others exist).

            There’s actually at least 15 different ways (the fifteenth one is called rye and it’s where I got that article from). And yes your entire post is super accurate. The pycharm thing is ridiculous too because RubyMine is excellent in comparison. You just pull in a library with Ruby’s excellent (singular) package manager, and then RubyMine is able to autocomplete it pretty much perfectly. PyCharm can’t even manage to figure out that you added a new dependency to whatever flavor of the week package manager you’re using this time.

          • zalgotext@sh.itjust.works
            link
            fedilink
            arrow-up
            2
            arrow-down
            3
            ·
            4 months ago

            Look, it’s fine if you prefer other languages to python, I won’t besmirch anyone’s preferences. But literally everything in your post exists in nearly every programming language (minus some of the typing stuff, I’ll give you that, but it’s getting a lot better). Like, every language has some learning curve to setting up tooling, or configuring your IDE the way you like it, or learning how to navigate documentation so that it’s useful, or trying to decide on one of the multiple ways of doing things. I guarantee, as someone with limited experience with Java, I’d have a difficult time setting up and using IntelliJ, and figuring out which build/packaging system I need to use, and figuring out how to use whatever libraries I need, simply because I’m unfamiliar with the ecosystem. That’s all you’re describing - the initial learning curve in getting familiar with a new language. Which is why I pointed out all the things I pointed out. It’s where I start when I’m introducing developers to python.

            • tyler@programming.dev
              link
              fedilink
              arrow-up
              2
              arrow-down
              2
              ·
              4 months ago

              No, it really is unique to python. Most other languages have one or two package managers, not 15 (15 is not an exaggeration). Ruby has one. Rust has one. Java has two (maven and gradle). Elixir has one. Swift has one.

              Python programmers think it’s normal when it most definitely is not. Even your IntelliJ example isn’t correct because IntelliJ will literally install and set up the jdk for you, but pycharm is completely unable to do that and it’s not because JetBrains hasn’t tried. Python tooling is just really really really bad.

      • CanadaPlus@lemmy.sdf.org
        link
        fedilink
        arrow-up
        2
        ·
        4 months ago

        I won’t feel bad about it then, lol. At least not until I’m collabing on something and they want to use Python.

      • CanadaPlus@lemmy.sdf.org
        link
        fedilink
        arrow-up
        4
        ·
        4 months ago

        A lot of people feel that way. If I need to generate a set of numbers or a certain string, though, it’s pretty easy to punch out a one-liner in GHCi, and that’s usually my use case.

        • lugal@sopuli.xyz
          link
          fedilink
          arrow-up
          7
          ·
          4 months ago

          I don’t know if you’re trying to be funny or your autocorrect is, but in Germany, when they switched from diploma to the bachelor/master system, both bachelor and master come with a theses. Many people leave with a bachelor, especially in computer science, so that might be why. Don’t know about other countries

          • SpaceNoodle@lemmy.world
            link
            fedilink
            arrow-up
            3
            ·
            4 months ago

            Ah, I see. They aren’t standard at US Universities, though I did have to complete capstone projects for each of my BS degrees.

            • lugal@sopuli.xyz
              link
              fedilink
              arrow-up
              2
              ·
              4 months ago

              It’s half a semester worth of credit points while the master theses is a whole semester here so it might be similar to your system