I want to learn another programming language now that I’ve been using Python for over 2 years now. I am kind of leaning on learning JS so that I can use it for the backend and also for the frontend. But the syntax is kind of weird. I heard Go is pretty good for the backend and also is compiled. What do y’all say? I also welcome other language recommendations.

  • @MotoAsh
    link
    22
    edit-2
    1 year ago

    JS will be far more versatile if you learn it well. It’s in so many dang things.

    The biggest annoyances about JS are some things that exist in Python, so you’ll already be familiar with loosely typed systems and mutatable objects (dictionaries/hashes or what ever Python calls 'em).

    Other than that, it’s mostly that there are a million ways to get the same things done, even something like, “define a class with static and instance-bound functions and properties”. Older JS techniques only use scope and the prototype and look like a gross hack. Modern JS has actual class syntax.

    It all stems from the constant enhancement of the language. Many, many nice features like proper class syntax and first class modules (no more third party module syntax) came in ES2015, and a sadly small number of front end devs to this day really know them well.

    Many web dev tutorials use older style techniques just because they’ve been around ages. If you learn how the new features are mostly syntax sugar on old styles, you’ll be a JS pro in no time.

    • clif
      link
      9
      edit-2
      1 year ago

      This is a great answer. Bumping it as someone who got forced to move into Node/JS around 8 years ago and came to love it (after the ES2015 changes :). It’s primarily what I work in and I teach community classes on it these days.

      I’ve been dabbling in Go lately for lower level server side stuff and, while I don’t dislike it, it’s a big shift in thinking. There are a lot of niceties to the Go ecosystem.

    • asudoxOP
      link
      31 year ago

      I see. Do you perhaps have a tutorial that does use those new features?

        • asudoxOP
          link
          5
          edit-2
          1 year ago

          There’s actually a save button for those kinds of things btw.

  • A_Dude
    link
    fedilink
    English
    171 year ago

    Go has a much cleaner syntax, and is better suited to its specific niche which is (relatively) low-level BE development. If you are attracted to that niche then Go is an excellent option. Also, Go is almost a default for developing for K8S, which might be another plus.

    On the other hand, JS is a more general-use language. It has a very loosey-goosey syntax and lots of weird behaviors. It is applicable on both FE and BE but be aware that in each of those, knowing JS is just a first step, since (for example) for FE development you will also need to know at least one of the major frameworks (React, Vue, Angular etc) as well as the page object model and a ton of other stuff.

    Bottom line- usually the language is the tool, not the objective. Figure out what you want to develop, then choose the optimal language to do it with.

  • @theherk
    link
    15
    edit-2
    1 year ago

    I can only say what I would do were I 20 years younger, and that is focus on Rust. I write a ton of Python, JS, and Go. Among them, Go is the most enjoyable and in my view has the best tool chain.

    But Rust’s tools are even better. And it is very low level when desired, but you can still write even frontends with great wasm bindings and UI libs.

    In the end, it doesn’t really matter. Just write.

  • @[email protected]
    link
    fedilink
    English
    131 year ago

    If you wanted to do both front and backend development TypeScript + JS/Node would make the most sense, no? I say this as someone who works with and enjoys working with Go almost every day, but there’s only so much time to learn new stuff.

    • asudoxOP
      link
      31 year ago

      I mean, I heard that new software engineers are allowed to work on the frontend first before the backend. So if I learnt JS now, I could master it, which would help me in the long run. Am I wrong?

      • @[email protected]
        link
        fedilink
        61 year ago

        Entirely depends on your skillset and company. That might be true somewhere, but seems strange.

        I do recommend you pick up typescript though. It will forcibly teach you some good habits, expectations, and some more base understanding of what you’re actually doing.

        • asudoxOP
          link
          2
          edit-2
          1 year ago

          Yeah, I was thinking of using TS anyways. I saw some video that showed how weird JS handles stuff when you try to add two things and such. I also want to make it a habit to type everything anyways. By the way, do I have to learn some more stuff if I want to use TS or is it just that it forces you to use types?

          • @[email protected]
            link
            fedilink
            31 year ago

            There’s a bit of fiddling with configuration and using npm, but it’s not much overhead. There’s plenty of tsconfig settings to customize the process for your need, but most the defaults are quite sane.

            • asudoxOP
              link
              11 year ago

              I see, then it won’t be a problem after I learn JS.

              • @[email protected]
                link
                fedilink
                11 year ago

                Well, TS is just JS with strong typing and type annotations. It’s almost the same language, just adding guard-rails and safety checks that the base language doesn’t have.

  • sarjalim
    link
    fedilink
    13
    edit-2
    1 year ago

    As someone else already said, don’t overthink the language choice aspect in general. If you learn almost any imperative language with C-like syntax (Go, JS/TS, C#, Java etc), picking up another one in the same “family” to a usable degree will be a very minor hiccup done within a very short time (hours). Sure, there are quirks and special syntax and different collections of built-in features for each one, but as a developer you will likely switch between several anyway and need to look up syntax from time to time - you know that something can be done, but the details how are a bit fuzzy.

    For instance, I code mostly in C# and JS/TS, but we have legacy applications written in VB.NET so I often google VB syntax for things that I know how to write in C#. I also occasionally code in C, have dabbled in Fortran, Python and PHP and I’m sure I’m forgetting one or two. SQL and LINQ syntax too of course. What you learn on your developer journey is that something can be done, but remembering the specific implementation in a specific language might be a job better suited for your search engine. That said, of course it’s good to start with one language that you know pretty well, but it seems like you’re already there with Python.

    The real challenge is learning the methodology of building applications, philosophy of OOP, patterns and program/application architecture and frameworks. Language choice is very much secondary to those areas of expertise imo.

    Personally though, I am partial to JS/TS as I’ve used those the longest, they are extremely versatile and frontend development is my favorite area.

  • @colonial
    link
    101 year ago

    I’m not a fan of Go from a language design perspective, but it does have plenty of technical merit (cheap coroutines, compiled) compared to using a scripting language for your backend.

    Some pointers on other languages:

    • Don’t sleep on Java/Kotlin or C# for your backend. They’re good languages with powerful, well-developed ecosystems. Kotlin even compiles to JS!
    • TypeScript is saner JS. Highly recommended.
    • If your backend is CPU-bound, Rust will let you squeeze out every ounce of performance at the cost of a relatively steep learning curve.
  • @tyvsmith
    link
    101 year ago

    Figure out what you want to build first, then pick the best tool for the job. A common fault of JS devs is trying to make it work for every platform and usecase as opposed to learning the best language for that platform.

  • @[email protected]
    link
    fedilink
    51 year ago

    Syntax wise, JS, specially TS has a great syntax and go is much weirder. I don’t care what the haters say. JS syntax is very understandable. And you can see why Rust has borrowed a lot of syntax from TS and JS. And I think knowing js is much more useful,but if you want to build big backends with good performance, go is better.

  • @aluminium
    link
    51 year ago

    You can use JS for almost anything, but nothing can be used where JS is mostly used.

  • @Solemarc
    link
    41 year ago

    IMO the specific language doesn’t matter here. Python has JiT compilers, AoT compilers, (proper) coroutine tools, front-end dev tools, everything you could need for dev work, that’s why it’s so popular, even if none of this is in the standard library.

    On the other hand, if you want to learn JS or Go you could use them as well. Last time I checked Go doesn’t really have any front end tools/frameworks though.

    Of the two I think Go is easier to pick up. Also, if Python is your only exposure to programming, you might be surprised to learn that syntactically, Python is the weird one, not the other way around.

  • @Loce
    link
    31 year ago

    If you decide to go with the NodeJS route and want a rapid development framework, my advice would be to check out NestJS.

  • @[email protected]
    link
    fedilink
    21 year ago

    Personally i prefer go, but these are pretty standard languages; so learning the in’s and out’s really isn’t all that time consuming (you aren’t going to have to change how you think about programming like say rego). Since you have python experience these should be no big deal, but maybe worth playing with a bit if you are trying to get a job in either language and need to cross off that bullet.

    As for expanding your learning, i’d try something like functional programming (haskell), or query language like rego above. Neither of these will be great for your resume though.

  • tuto
    link
    brezhoneg
    21 year ago

    I personally don’t like anything JS related. I would simply recommend Go, but even that is not really my go-to. I found learning Nim quite entertaining, and it’s middle -ground between Pyhton and Go, which can also target JS, if you want to.

  • @[email protected]
    link
    fedilink
    English
    11 year ago

    You can try C# and see if you like it. You can do frontend in it as well, but C# isn’t as popular on frontend as JS, so it will be harder to get a job as frontend dev. But on the backend C#/.NET is the best choice for me.

  • @[email protected]
    link
    fedilink
    11 year ago

    I‘d say it depends on your motivation and your reasons for learning another language. Do you want to build something in particular? In that case, pick the right tool for the job, as the others have suggested. However, if you want to broaden your horizon, I would suggest to try a language based on another paradigm, e.g. a functional language such as Haskell, ML, or OCaml. Want to see some „pure“ object-oriented language? Then maybe have a look at Smalltalk. The languages I have listed may not be the most widely used in practice, but in my experience, knowing several different programming paradigms makes you a better developer overall.