• RandoCalrandian@kbin.social
    link
    fedilink
    arrow-up
    59
    ·
    1 year ago

    Refusing rust and wasm is a signal you don’t care about code quality or security

    See? You can keep playing that game all the way down to the most onerous language

    • upstream@beehaw.org
      link
      fedilink
      arrow-up
      9
      ·
      1 year ago

      Writing code that can’t be scientifically proven to be correct on all hardware it might run on means you don’t care about code quality. /s

      The Internet is full of people with a bloated ego trying to justify their opinion and gatekeeping others.

      I see this more and more in software as well.

      Not sure if it’s always been like this, or if I just notice it more.

      Same way there’s thousands of people giving you a guide to write a task list in , but as soon as you want to use anything slightly more complex than what you can learn from working a few hours with something you quickly run out of material and is usually left to fend for yourself.

    • MrGG@lemmy.ca
      link
      fedilink
      arrow-up
      8
      ·
      1 year ago

      Actually, if you really care about quality and types on the front end rust+wasm is not a bad idea 🤔

      Now that I’ve typed that and read it back, were people using TypeScript for anything other than front-end web dev?

      • PenguinCoder@beehaw.org
        link
        fedilink
        English
        arrow-up
        7
        ·
        edit-2
        1 year ago

        Because at the end of the day TypeScript is still Javascript and it’s still bad. Just has some verbose formats to try and make weakly typed language (javascript) appear to be strongly typed. It adds more build steps to what shouldn’t be there; build steps make sense for apps, they make much less sense for libraries.

        https://dev.to/bettercodingacademy/typescript-is-a-waste-of-time-change-my-mind-pi8
        https://medium.com/@tsecretdeveloper/typescript-is-wrong-for-you-875a09e10176

        • pjhenry1216@kbin.social
          link
          fedilink
          arrow-up
          4
          ·
          1 year ago

          I’m sorry. Whoever wrote that should give up trying to write articles. It’s poorly written and will never convince anyone to change their mind. It’s shit. “I know how to convince people they’re wrong. Insult them. Setup a ton of strawman arguments. Genius.”

          Whoever wrote that is bad and should feel bad.

            • pjhenry1216@kbin.social
              link
              fedilink
              arrow-up
              3
              ·
              1 year ago

              Second one. Just realized there were two. Being close together and the first being long enough to get trailing “…” it all just looked like one big link when I first saw it. May just be Kbin displaying it that way.

        • Fushuan [he/him]@lemm.ee
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          build steps make sense for apps, they make much less sense for libraries.

          This might be true, but it’s not about build steps, it’s about having detailed iformation of the types of the objects that the library is serving. not knowing the typing of the functions a library is serving is… poor. Maybe typescript is too strict and having something like type hinting like python has would be enough since linters pick up the hints from the libraries, but doing just JS only fuck the people that use the library.

      • upstream@beehaw.org
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        We use TypeScript for our node.js backends.

        We had two that started out vanilla, but it became too painful to maintain.

        • MrGG@lemmy.ca
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          That is disturbing. From my perspective, anyway. There are already so many great (and more appropriate) stacks for web backends, why Frankenstein a Frankenstein into it?

          • The Cuuuuube@beehaw.org
            link
            fedilink
            English
            arrow-up
            4
            ·
            1 year ago

            🤷 people like nodejs and people like type hinting and IDE reflection. Typescript helps a lot with that

      • TehPers@beehaw.org
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        It can with some glue code that you better be writing in TypeScript if you care about code quality.

        (As far as I know, it can’t manipulate the DOM directly. Maybe things changed in the past couple months since I checked, but I doubt it.)

      • abhibeckert@beehaw.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        WASM allows arbitrary code execution in an environment that doesn’t include the DOM… however it can communicate with the page where the DOM is available, and it’s trivial to setup an abstraction layer that gives you the full suite of DOM manipulation tools in your WASM space. Libraries for WASM development generally provide that for you.

        For example here’s SwiftWASM:

        let document = JSObject.global.document
        
        var divElement = document.createElement("div")
        divElement.innerText = "Hello, world"
        _ = document.body.appendChild(divElement)
        

        It’s pretty much exactly the same as JavaScript, except you nee to use JSObject to access the document class (Swift can do globals, but they are generally avoided) and swift also presents a compiler warning if you execute a function (like appendChild) without doing anything with the result. Assigning it to a dummy “underscore” variable is the operator in Swift to tell the compiler you don’t want the output.

  • MrGG@lemmy.ca
    link
    fedilink
    arrow-up
    26
    ·
    1 year ago

    Expect to see more posts like this. With a few projects announcing they’re dropping support for TypeScript we’re going to have developers worrying that this tech that they’ve sunk so much time into is suddenly becoming obsolete, so they’re going to evangelise hard in favour of it as a defence strategy. Same thing happened when Perl went out of flavour.

    • SokathHisEyesOpen@lemmy.ml
      link
      fedilink
      English
      arrow-up
      11
      ·
      1 year ago

      I’ve seen so many front-end libraries come and go over the 25 years I’ve been doing this. Be good at programming in general, and you can usually hop on board the incoming train pretty easily and hop off again before it goes off a cliff. You can’t really get too attached to anything in an ever changing industry.

    • pjhenry1216@kbin.social
      link
      fedilink
      arrow-up
      8
      ·
      1 year ago

      Only a few libraries announced dropping support due to their requirement generics. It’s not that big a deal. TS is still popular.

      • MrGG@lemmy.ca
        link
        fedilink
        arrow-up
        9
        ·
        1 year ago

        I said a few, friend 😛 I agree it’s not a big deal, but for developers that are totally entrenched in that ecosystem it might be alarming. Hence OP’s post.

  • TehPers@beehaw.org
    link
    fedilink
    English
    arrow-up
    15
    ·
    1 year ago

    Man there have been hot take after hot take in the programming communities over the past few days. Here, I’ll give my hot take since nobody asked:

    If I have to touch your code and I can’t tell what inputs it’s supposed to accept, what it should do with those inputs, and what outputs it should produce, I’m probably deleting your code and rewriting it from scratch. Same goes for if I can trivially produce inputs or states that break it. If your code is buggy, it’s getting fixed, even if that takes a rewrite.

    When working with others, write readable and maintainable code that someone with much less context than you can pick up and work on. It really doesn’t matter if you need to use TypeScript, mypy, tabs, doc comments, or whatever to do it.

    When doing your own project, it doesn’t matter. It’s your code, and if you can’t understand it when you come back to it then you’ll probably rewrite it into something better anyway.

  • sandriver@beehaw.org
    link
    fedilink
    arrow-up
    13
    ·
    1 year ago

    Reading the responses here, why are people so mad about types? Maybe I’m biased coming from a background of statically typed languages and mathematics. I’d rather have a good typing system that makes me think about data than just hoping I’ve thought about a problem right.

    • wewbull@feddit.uk
      link
      fedilink
      English
      arrow-up
      6
      ·
      edit-2
      1 year ago

      I’d rather have a good typing system…

      So not typescript then.

      I’m half joking, but the problem with typescript is that it’s JavaScript with types. The industry needs to stop retrofitting types to dynamically typed languages. The type system is an intrinsic part of the language design and if you’re going to have it, it should be there from day 1. Being dynamically typed wasn’t a language bug. It is a feature designed for a certain class of problem. I’m sure 90% of proponents only want it so they get better completion in their IDE, but I personally think it makes a lot of code far more difficult to read.

    • abraxas@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I have valid criticisms of statically typed languages, based around code patterns that are both expressive and efficient that are either difficult or impossible to implement in a statically typed language without “an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.”

      Typescript, however, is different. Its type annotation functionality is not the same as a static type system, which means I get to keep all those things I like about dynamically typed languages while still having compile-time validation.

      Flip-side, however, is the complete lack of runtime validation in typescript, and the fact that junior developers trip on that a lot. I would call that a real advantage of javascript (if not enough to stop me from using Typescript). Having no check at all is better than being convinced typescript is protecting you when it’s not.

  • YeeHaw@beehaw.org
    link
    fedilink
    arrow-up
    12
    ·
    1 year ago

    After having to use TypeScript in a project, I don’t see much usefulness. It feels more like a weird linter, than an actual language with extra features. It’s tons of ugly boilerplate for little gain, at least so far in my experience.

    • abraxas@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      It is a weird linter, and it can definitely be misused. It saves me hours of work at least a couple times a month, however.

  • BitOneZero@beehaw.org
    link
    fedilink
    arrow-up
    9
    ·
    1 year ago

    I’d say the debate about using a strongly typed relational database and ORM is probably more of an impact on end-user turn around than typed language.

  • Bipta@kbin.social
    link
    fedilink
    arrow-up
    9
    ·
    1 year ago

    This is the core thesis of the article:

    It’s true that sometimes you have to write non-trivial types to convince the compiler that your data is correct.

    That’s okay. Creating maintainable code with high quality often requires putting in the hard work.

    There’s no real substantiation of the claim; just the claim itself.

    Yes TypeScript is onerous but that’s just alright.

    Maybe it’s true but it’s a weak argument.

  • forestG@beehaw.org
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    So what is it with Anakin’s picture? Javascript is the dark side of the, web development, force? XD

    Seriously tho, valid points.

  • abhibeckert@beehaw.org
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    1 year ago

    I don’t even know what Turbo 8 is

    Maybe you should find out?

    The idea behind Turbo is your server sends HTML/CSS to the client, and when the content needs to be updated… the server simply sends new HTML which Turbo will inject into the page. You can also annotate links so they fetch new content from the server instead of navigating to a new URL.

    Your server side code can be written in whatever language you prefer… Turbo being a 37Signals project I assume they’re using Ruby. It’d work fine with TypeScript too if that’s your thing. Turbo just uses HTTP / JSON to talk to the server and doesn’t have a server side component.

    You can have client side code, but AFAIK there’s pretty minimal interaction with Turbo - you might for example add an event listener that processes the HTML and as converts ISO date/times into Date.toLocaleString().

    If you’re writing complex client side code then you shouldn’t be using Turbo at all.

    This change doesn’t affect, at all, the language used by users of Turbo. What’s changed is the Turbo dev team themselves have chosen to write Turbo in vanilla javascript. And there are advantages to vanilla JS - it removes the compilation step from one language to another, for example.

    • Fushuan [he/him]@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      And there are advantages to vanilla JS - it removes the compilation step from one language to another

      IDK about the potency of the pc they used to compile but… it takes less than 10 seconds usually, booting up the testing server with the updated code though CI/CD takes much longer. it’s not abouthte compilation step, that’s a non-issue, it’s about the extra effort they don’t want to put to do the typing.

  • TheCee@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    1 year ago

    Or a signal that you’d rather not support the worst way to introduce type systems to frontend dev. While I’m not sure that applies to DHH, I am sure there are other devs that understand compromising all your goals to codepend on Node or even JS itself isn’t that much of a win and rather see support for better options.

  • 🦊 OneRedFox 🦊@beehaw.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I prefer strong static typing for the most part. I find it difficult to mentally model code when it’s not clear what exactly is being passed to functions and whatnot. Can also use them to help ensure code correctness. TypeScript has been a welcome addition to my projects over the years and honestly I want them to implement more functionality like pattern matching expressions.