i absolutely hate how the modern web just fails to load if one has javascript turned off. i, as a user, should be able to switch off javascript and have the site work exactly as it does with javascript turned on. it’s not a hard concept, people.

but you ask candidates to explain “graceful degradation” and they’ll sit and look at you with a blank stare.

  • Jimmycrackcrack@lemmy.ml
    link
    fedilink
    English
    arrow-up
    31
    arrow-down
    1
    ·
    2 days ago

    I don’t know anything about web development but, is it really fair to say it should work exactly the same with JavaScript turned off? If that were achievable why would it be there in the first place? I assume the graceful degradation concept is supposed to be that as you strip away more and more layers of additional functionality, the core functions remain or at least some kind of explanation is given to the user why things don’t work.

    • Frezik@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      1
      ·
      1 day ago

      As a web dev, I’ll say that yes, it is achievable. The problem isn’t what’s possible, but that we’ve trained new frontend devs in certain ways and given them certain tools. Those tools are being used in places they shouldn’t, and those same new frontend devs are failing to learn the fundamentals of HTTP and HTML.

      React, for example, is a JavaScript framework that’s become incredibly popular in recent years. It’s meant for “single page applications”. I once made a control panel for a vacuum former with it, where you could turn on zones of heating and get the temperature updated in real time. You’re not expected to navigate away from that page while you’re using it. I think this is a good place to use React, though you could make the argument that it should be a native GUI app. (I’ll say that it isn’t that important; this thing runs fine on a Raspberry Pi 3, which is the target platform).

      React is not a good option for an ecommerce site. You want to click on a product to check out its details. That means you’re going between very different views (pages) a lot. React increases complexity with no clear gain. An argument can be made for the address/payment/finalization steps. The money people like that because there’s a strong correlation between streamlining checkout and how often cash ends up in their hands.

      A lot of those sites use React, anyway, for everything. Why? Because we’ve trained a bunch of new frontend devs so much on it that they have no idea how to make a site without React. This overspecialization has been detrimental.

      • Mose13@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        I’m a full time React and React Native developer. Imo, the frustrations with react are when you server side render. React without SSR is much simpler. But you are 100% right about picking the technology that meets your project’s requirements.

        However, let me play devils advocate. Why do you need to SSR your e-commerce site? To optimize your SEO? Seems to me that SEO lately is a lie we’re being sold to make it easier for LLMs to chew through the entire internet, including your SEO e-commerce site. Imo, search engines have stopped serving the consumer. If we forget the SEO component for a second, you could build a killer e-commerce site that uses React and deliver a great user experience. If this is all about SEO, then I’m sure there is lots of garbage we could inject into our projects that would boost SEO. We could add LLM written top 10 articles to a fake blog on our site that nobody actually wants to read, and boost our Google ranking.

        • Frezik@lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 day ago

          It has nothing to do with SEO. We do server side rendering because it’s the simplest thing that works.

          • Mose13@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 day ago

            It’s simple when it’s all SSR or it’s all client side rendered (CSR). In my experience, mixing is when the headache sets in. There are benefits to SSR and CSR. You want a webpage that works without JavaScript, use SSR. You want a persistent video player that continues the current video as you navigate pages on your site, use CSR.

    • ElectricMachman@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 day ago

      People do stuff in JavaScript that you really don’t need JavaScript for. You don’t need JS to display a store listing, for instance. Or a news page, or documentation, or even a search engine

      • Jimmycrackcrack@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        Ok, I’m seeing this a lot and I get it, and despite my lack of expertise in the field I can sympathize with the sentiment. Perhaps those replies are answering more in the spirit of the post than the letter.

        It’s just that the title asked if no one knew what this ‘graceful degradation’ concept was anymore and the text used the example specifically that the page should be exactly the same with or without JavaScript switched on which, without trying to be facetious, sounded kind of logically impossible.

        • ElectricMachman@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 day ago

          I get you. I think you’re right - if you have a page which does make heavy use of JS, it can be difficult if not.impossible to replicate the same behaviour without it. HOWEVER: you can often get something close enough!

          To go back to my shop example: yes, you can use JS to show a richer shopping experience, with pop-up windows, filtering, and the ability to add to cart without leaving the page. Graceful degradation would be to show the same listings, but without the more convenient features that use JS - so without popups, with filtering that refreshes the page, and a completely separate cart.

          Some apps really can’t function without JS, because they are… well, apps.