• kirk781@discuss.tchncs.deOP
    link
    fedilink
    English
    arrow-up
    70
    ·
    4 days ago

    Java was also my first introduction to programming as it was included in Computer Science in final year of school (at college, we did the trusty C).

    I think they have replaced Java with Python now in schools because of the latter’s popularity and also because many would argue, Python is slightly easier to learn than Java.

    • kescusay@lemmy.world
      link
      fedilink
      English
      arrow-up
      69
      arrow-down
      4
      ·
      4 days ago

      Python is easy, but it can also be infuriating. Every time I use it, I’m reminded how much I loathe the use of whitespace to define blocks, and I really miss the straightforward type annotations of strong, non-dynamically typed languages.

        • kescusay@lemmy.world
          link
          fedilink
          English
          arrow-up
          8
          ·
          3 days ago

          Oh, I know you can, but it’s optional and the syntax is kind of weird. I prefer languages that are strongly typed from the ground up and enforce it.

          • sugar_in_your_tea@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            3
            ·
            3 days ago

            Python is strongly typed, it’s just not statically typed. Python with consistent type hinting is extremely similar to a statically typed language like C#.

            • kescusay@lemmy.world
              link
              fedilink
              English
              arrow-up
              2
              ·
              3 days ago

              I would argue that without consistent and enforced type hinting, dynamically typed languages offer very little benefit from type-checking at runtime. And with consistent, enforced type hinting, they might as well be considered actual statically typed languages.

              Don’t get me wrong, that’s a good thing. Properly configured Python development environments basically give you both, even if I’m not a fan of the syntax.

              • sugar_in_your_tea@sh.itjust.works
                link
                fedilink
                English
                arrow-up
                1
                arrow-down
                1
                ·
                3 days ago

                What’s wrong with the syntax? It’s just var_name: Type = value, it’s very similar to Go or Rust. Things get a little wonky with generics (list[Type] or dict[Type]), but it’s still similar to other languages.

                One nice thing about it being runtime checked is you can accept union types, def func(param: int | float), which isn’t very common in statically typed languages.

        • JackbyDev@programming.dev
          link
          fedilink
          English
          arrow-up
          3
          ·
          3 days ago

          But nobody else does, and I need it more on code I am consuming than producing. In fact, many functions rely on being able to send various types for different behavior. Dynamic programming is crazy to me. It’s like guessing. I don’t know what type your code is accepting and I have to guess based on the name of read your code directly.

          • sugar_in_your_tea@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            1
            ·
            3 days ago

            I have the opposite experience, a ton of libraries I use provide optional types, and the handful that don’t often have a good reason for it (e.g. numpy). Our projects at work have types almost everywhere, and it’s pretty nice to work with.

      • rottingleaf@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 days ago

        I hated something about Python, and avoided it, until encountering Tcl which for me fulfills the same role that Pythons seems for many people, but Tcl is really much more pleasant. IMHO.

    • gravitas_deficiency@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      32
      arrow-down
      3
      ·
      4 days ago

      I don’t think weakly- or dynamically-typed languages are a good thing to base computer science curriculum around. Yes, it’s “easier”. But you will genuinely have a FAR better understanding the language and the logic you’re writing in it if you work in the scope of strong and static typing - or, at least have linters that force you to (e.g. mypy for Python)

    • padge@lemmy.zip
      link
      fedilink
      English
      arrow-up
      13
      arrow-down
      1
      ·
      4 days ago

      The argument I agree with is that Python is the best language to learn if it’s your only language, and Java is the best first language if you’re going to learn others. The syntax from Java is shared across so many other languages and it forces you to learn about things like objects and types. You could make an argument for C or C++ but Java’s handholding is more beginner friendly imo

      • taladar@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        9
        ·
        3 days ago

        Python isn’t really strict enough to be a good learning language and Java has too much accidental complexity that literally matters in no other language.

      • jaybone@lemmy.zip
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        1
        ·
        3 days ago

        First learn C, then learn C++, then learn Java. In that order, each will make you appreciate what the previous one lacks. From there, you should pretty much be able to learn anything.

    • MolecularCactus1324@lemmy.world
      link
      fedilink
      English
      arrow-up
      11
      arrow-down
      1
      ·
      edit-2
      3 days ago

      I learned C++ as my first language and it was a great way to understand the core issues of a programming language — like memory allocation, memory freeing, the difference between memory addresses and the memory contents themselves, threads, system calls, etc. Java obscures these nuances to a degree, but Python is too friendly and makes it hard to understand them at all.

      I believe if you learn C++ you can easily learn any other language. After C++, I learned Python, JavaScript, and Java in a few days each without formal instruction. If you learn Python first, you’re probably going to struggle learning those other languages because you haven’t grasped the lower level concepts yet and may never if you’re not in a formal setting that forced you to learn them.

      No one disagrees that Python is easier, but if your goal is to get a foundation in programming that allows you to easily pick up other languages, you should start with C++.

      • pycorax@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 days ago

        Imo people should start with C first since it is a lot simpler than C++ while still providing a lot of what you mentioned. C++ adds a lot of things like name mangling, templates, L & R value references that can quickly make things a bit more daunting for beginners.

        I also generally find error messages for C a lot more parsable for beginners than C++ ones.

        • MolecularCactus1324@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          3 days ago

          C++ has classes though and if you start with C and then try to go to other Object-oriented languages you’ll be a little lost. But, by learning C++ first, you’re pretty much learning C at the same time, you just need to avoid using classes.

    • atomicbocks@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      4
      ·
      3 days ago

      Python is interpreted where Java is compiled. They aren’t going to be able to be used in the same cases all the time.

      • jenesaisquoi@feddit.org
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        2
        ·
        3 days ago

        Not true. They use the same model, executing compiled bytecode. It just feels like directly running a script because Python compiles it to bytecode on the fly, and because it is embarrassingly slow.

    • chakan2@lemmy.world
      link
      fedilink
      English
      arrow-up
      9
      arrow-down
      4
      ·
      4 days ago

      They did, but it makes me sad. Python is becoming the next JavaScript because of its ease of use.

      The Java guys simply don’t understand how to code without the gang of 4 crutch to lean on.

    • MrRazamataz@lemmy.razbot.xyz
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      In a first year computer science course at uni I can say they teach us Python, Java, and C, all with slightly different use cases.