•  MrGG   ( @MrGG@lemmy.ca ) 
    link
    fedilink
    3310 months 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.

    • 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.

      •  MrGG   ( @MrGG@lemmy.ca ) 
        link
        fedilink
        910 months 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   ( @TehPers@beehaw.org ) 
    link
    fedilink
    English
    2710 months 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.

  • 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   ( @wewbull@feddit.uk ) 
      link
      fedilink
      English
      6
      edit-2
      10 months 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.

    • 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.

  • 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.

    • 100% agree. Typescript is just a bandaid on top of a broken language. Sure it’s better than bleeding, but it’d be preferable not to get injured in the first place.

      And you can still apply the bandaid wrong.

  • 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.

  • Damn right. I care about getting features in the hands of my users. If code quality helps with that, if type script helps with that, I’m all in favor.

    But the moment I care about code quality for its own sake you need to sack my ass like yesterday.

      • I think vzq’s point is that you can write good, readable code that doesn’t do what the user wants. Same with other metrics that are ripe for navel-gazing like code coverage.

        It’s bordering on a false dichotomy… but I also believe that dynamic, untyped languages have proven exceptionally useful for rapid prototyping and iteration.

        •  vzq   ( @vzq@lemmy.blahaj.zone ) 
          link
          fedilink
          11
          edit-2
          10 months ago

          I must admit that I write that deliberately to annoy the “code quality is everything” brigade.

          I have no issues prioritizing maintainability where needed, but in my experience people that dogmatically prioritize code quality are not honest with themselves. They almost never chase code quality in general. They are always looking to enforce some burdensome standard or specific tool or archaic process or fiddly CICD script, and if you push back they go cry in a corner about the abstract virtue of “code quality”.

          Just be straight with me. You enjoy using type script. Tell me how it adds value to the product and the customer.

          Stop trying to shame me into it. I can’t be shamed. I have no shame. I’m a professional software engineer.

        • but I also believe that dynamic, untyped languages have proven exceptionally useful for rapid prototyping and iteration.

          Except that prototypes never end up as just prototypes, they die or become the real app with lots of masking tape.

      •  vzq   ( @vzq@lemmy.blahaj.zone ) 
        link
        fedilink
        6
        edit-2
        10 months ago

        What an utterly blind, self-centered view.

        This is a really surprising retort.

        In the end, the only thing that has value is what ends up in the user’s hands. The rest is only a means to an end, in the very best case.

        This is not a controversial take in professional software development.

        What is self centered and self absorbed is putting misguided notions of “craftsmanship” and maintainability over business needs.

        • If you can’t see that writing readable code is part of the means to that end, I don’t know what to tell you. If nobody can maintain the codebase because it’s a mess of spaghetti logic and 20-deep dependency trees (I’m looking at you, every JavaScript project I’ve ever seen), the end product is going to suffer while also making every single engineer working on it want to leave.

          This is not a controversial take in professional software development.

          Funny, it sure seems like “maintainability should not be a priority” is a pretty controversial take to me.

          • You are making a lot of assumptions. You don’t know what my product is, how it is developed, what it’s used for, what its lifecycle is. Whether improving maintainability or code quality would be a net benefit, and whether using type script would be a possible solution.

            You also didn’t bother to find out.

            You just charge at me guns blazing, trying to string me up for heresy.

            Funny, it sure seems like “maintainability should not be a priority” is a pretty controversial take to me.

            How many things can you prioritize?

            In my world we prioritize one. And that not the one.

    • maintainability is arguably not a value-added for the end user. But still absolutely important. Robustness of code is arguably not visible to an end-user, until it fails. And that’s very important. Features are great, but quality is still important and is basically the mortar between the bricks that are features. Only caring about features leads to poorly written applications.

  • 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.

    • 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.

  • 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.