I learned “pure” JS back in 2013, when HTML5 was brand new, and I still don’t get most of the stuff going on nowadays.

  • @[email protected]
    link
    fedilink
    English
    24
    edit-2
    11 months ago

    I work on a large code base that was built in .NET 4 with a lot of jQuery for the front end. We’re modernizing it, but it’s very slow work. A significant part of the work is improving the organization of scripts, of which there are thousands. We’re not even prioritizing getting rid of jQuery, because it works. To rewrite all the stuff that works, instead of focusing on structural matters, dependency management, maintainability and security, would be insane. (And that’s just the JS bits, on top of which there’s all the legacy .NET stuff to do.) We aim to get it into a state that will leave it working and maintainable in future without excessive effort.

    Sometimes I wonder who these people are who always promote this year’s library or framework, then next year promote something newer. Do they work in real companies with real applications under heavy use? Have they ever had to maintain a codebase that was written more than 6 months ago? Or do they just build proofs of concept and small apps and pontificate a lot, then move on to the next job before things get serious?

    • @[email protected]
      link
      fedilink
      English
      7
      edit-2
      11 months ago

      We did a full rewrite of our site years ago going from backbone to react and TS. We just did it page by page, clean sweep on each page, all new work done on a fresh slate with the old code base being abandoned page by page but otherwise left alone until all the pages were migrated at which point we could just completely drop the old code base. We’re so much more productive now and happy working on the code base. Refactors are much easier than before as well.

      I’ve worked on massive jQuery code bases before and they turn into worthless spaghetti code in no time at all. Dynamically altering html with no source of truth is the worst pattern you could have on a frontend. I have a ton of respect for what the jQuery library introduced but it was never a framework and was used in a terrible patchwork way. I wouldn’t even bother trying to save any of it. Clean split and keep that codebase tightly quarantined behind lock and key and don’t let it even touch the new code base. The spaghetti code it creates is like a virus.

      • @[email protected]
        link
        fedilink
        English
        211 months ago

        Yeah that would be great to do but we are very underresourced so the technical debt just keeps building up.

    • @[email protected]
      link
      fedilink
      English
      611 months ago

      I work on marketing websites which are essentially disposable. So every 3 years you start over from scratch (in a new version of some CMS). So I don’t get to build super cool functionality much, but I do get to work with newer tech stack. (I still don’t need 99.99% of the js frameworks flavors of the week)

      • @[email protected]
        link
        fedilink
        English
        5
        edit-2
        11 months ago

        That makes sense. If you’re pumping out websites it’s quite a different situation from developing large applications that need to run for many years. Same if you’re developing lots of little apps.

    • snoweA
      link
      English
      611 months ago

      That second article is hilarious. It’s trying to point out that the first article is over complicating things then doing the same thing except the author thinks it’s not complicated what they’re saying when it’s actually insane.

  • delirium
    link
    fedilink
    English
    1211 months ago

    Always confused when I see memes like this

    You learn js, then you learn a bit about ts and pick react/vue if you want to do frontend or nodejs if you’re into backend. Then you do something basic, like a barebones twitter clone, weather app, etc. By the point when you’re 80% done, you will know most important parts of the ecosystem naturally

    After that, learning all the supporting libraries/frameworks is super simple since next is just superset around react, same for nuxt. Solid, svelte, fresh etc are just different flavors of react. Even vue is looking like react this days with composition api, simply because they nailed the simplicity and dev comfort. Average dev will never face weird js/ts parts or confusing libraries because most of their day to day job will be moving buttons and looking how to persist user basket in browser storage…

    Sure there are a lot of libraries and ways to do stuff, but 90% of them are irrelevant, only-for-hobby or simply dead and unused since 2010. Knowing ts+(react|vue)+(vuex|redux-tk|mobx)+(styled|tailwind) will land someone a basic job where they can progress and expand their knowledge lol

    • I Cast FistOP
      link
      English
      1011 months ago

      The joke is that nearly everything these libraries/frameworks do is complicate what used to be simple

      • delirium
        link
        fedilink
        English
        511 months ago

        All these things are solving different problems and you absolutely don’t have to use them if they complicate your current workflow.

        I can’t imagine making a high interval trading app, things like notion or figma without modern libraries.

        jQuery only gets you so far before you will wake up in unmaintainable hell where your team has to re-invent the wheel

        • I Cast FistOP
          link
          English
          611 months ago

          You don’t need any of that, not even jquery, to display static content, or even to make a decent commerce page (shopping, booking, tickets). I would wager the vast majority of the internet does not need to work like Figma or Notion (or old timey chatrooms, for that matter), with real time changes being sent to all connected sessions.

          • Thinker
            link
            fedilink
            English
            -211 months ago

            Yes, that is true. But actually it’s more than that: you don’t need a dev to display static content or a decent commerce page anymore. Square space and it’s competitors give more options at a better value to the layman than devs using PHP or jQuery could hope to these days. We have the simple websites, so frameworks very specifically target productivity and maintainability for complex web apps.

      • Thinker
        link
        fedilink
        English
        -2
        edit-2
        11 months ago

        This is not true. The higher complexity of frameworks is unarguable, but it reflects the higher complexity of modern web apps. The reality is that React/Vue/Svelte achieve things that are simply infeasible with e.g. the LAMP stack or jQuery.

        • @akrz
          link
          English
          111 months ago

          well, they are theoretically feasible, but practically infeasible

    • @[email protected]
      link
      fedilink
      1
      edit-2
      10 months ago

      I tried to learn React, but it was unnatural for me, but then senior front dev at my workplace suggested Vue. I remember Vue’s options api being too weird to even try it.

      Then I discovered there’s composition api and fell in love with it. React’s flow without its weird quirks.

      I think Svelte is next step towards feeling as natural as possible.

  • SavvyWolf
    link
    fedilink
    English
    1011 months ago

    I stepped out of webdev like 5 years ago. Now every time I try to get back into things to work on an open source project or whatever I just give up because I do not understand things.

    Everything seems to be based on React which is some kind of magic templating library that does everything? And also dynamically updates thing in response to changes and talks to the server?

    I much prefer the days of just using vanilla js to manipulate a DOM and talk to a well defined API.

    • @[email protected]
      link
      fedilink
      English
      411 months ago

      I’m sorry but framework and library in this post are going to be used loosely, because even React, Vue, Angular, Svelte, etc devs use the terms loosely.

      React is mostly a UI library like you would find in most native app development. Of them all them JS frameworks/libraries is one of the less opinionated and with less batteries included. By design it does not does everything. Most other frameworks do way more.

      It lets you define custom components. The components can have properties that their parent component defines and internal state. If the state or the properties change the component gets redrawn (magically). There are some lifetime functionalities (things to do on first render for example) and performance improving stuff (memoization) but mostly that’s it.

      All the other features you talk about are third party libraries or frameworks that can operate with react or are build on top of and cover the bases, like routing, fetching, caches, server side rendering, styling utility libraries, component libraries, animation libraries, global state management, etc.

      The big difference with the vanilla way is that the approach is mostly declarative. The runtime takes charge of updating the DOM when your components state or properties change.

      You take a big performance hit, and an even bigger bundle size one, but the speed of development and huge ecosystem of readymade solutions can be really important for some use cases.

      Other frameworks take different approaches to solve the same problems:

      • Component system for code reuse and organization.
      • Some way to manage state
      • Some way to decide what to re-render and when.
      • Extra stuff. Some frameworks end here, some have tools for everything you would need for a web app.
    • @[email protected]
      link
      fedilink
      110 months ago

      The thing is, they look like too much for a simple app with near none interactive elements.

      But once app starts growing, concepts like reusable components, reactivity and state management become such an important tool.

      Imagine tracking shopping cart’s total value. With these frameworks it’s just one store containing total value, exposing the value as reactive state. Once the value changes, all components using directly or indirectly that value update immediately. In vanilla you would have to keep track of every instance where that value is used manually.

      Additionally, if you decide keeping total value of cart in frontend is stupid (because it is), you just modify your store to provide only readonly value, and create setters that require you to pass item or item id. Then that setter would hit up backend keeping your cart’s total value, add an item, and backend would return new total, which would now be set as that store’s new total value.

      These frameworks are kind of SOLID principles applied to chaotic world of user interfaces.

  • @[email protected]
    link
    fedilink
    English
    511 months ago

    I learned JavaScript waaaay back when from this book. I used to carry that around in my rucksack at high school :-\

    • @[email protected]
      link
      fedilink
      English
      211 months ago

      That worked out well - one copy in stock for £4.05. I’ve been trying to learn JavaScript for a while, so thanks for the recommendation :)

  • @[email protected]
    link
    fedilink
    English
    411 months ago

    By the time you get around to learning a js framework the next one is out or they have broken api compatibility between versions . Not to mention the mess that is supply chain attacks with everything pulling in the kitchen sink.