News for hackers. Stuff that matters.
Re:A little bit of plain JavaScript can do a lot by triceratops on Sunday June 21, 2020 @02:24AM (#23590278)
Pretty much this. I knew all of the things she wrote about but all I could think was "I can't imagine writing foo.classList.add and remove 100 times. That's going to create some major spaghetti code once that project grows beyond a couple of pages"
Re:A little bit of plain JavaScript can do a lot by bigiain on Sunday June 21, 2020 @03:42AM (#23590519)
There;s some deep truth here, and I suspect it's about a fundamental difference between "writing a plain vanilla JavaScript application" and "I wanted to use the same HTML to generate both a PDF (with Prince) and to make an interactive version of the questions."

Reimplementing gmail or slack in html/css/vanilla-javascript, without an "application frameowrk is no doubt an exercise in futility.

At the same time, reaching for React/Fluttr/Angular/frontend-framework-de-jour when all you need is to show and hide divs and maybe do css or scroll animations between them is, in my mind, an equally bad decision.

(I can totally see why the framework-de-jour option gets chosen so often though - because no matter how written-in-stone the original specs saying "There wil be no functinality required beyond showing/hiding divs and css animations between them" are, we've all seen projects where a last minute critical/showstopper requirement for the web page to include something insane like a fully functional email client gets dropped in the FE dev's lap the Friday afternoon before launch Monday. Sure, the FE dev made the choice to use React, and while some (perhaps a lot?) of that is "resume driven development", at least some of the blame is on bad sales people and project managers as well...)

Re:A little bit of plain JavaScript can do a lot by triceratops on Sunday June 21, 2020 @05:03AM (#23590824)
> reaching for React/Fluttr/Angular/frontend-framework-de-jour when all you need is to show and hide divs and maybe do css or scroll animations between them is, in my mind, an equally bad decision.

Do people really do that? To me, that reflects bad frontend engineering practice. Even so for something like that, I'd use jQuery or something similar, because it's a much nicer API than the DOM.

Re:A little bit of plain JavaScript can do a lot by dgb23 on Sunday June 21, 2020 @02:32PM (#23594122)
How do you generate html in the first place? With React you have the same UI logic in one uniform framework. Whether you render statically, on request or in the client doesn’t split up your code. Everything plays together nicely. You get sensible editor support with linting and static analysis and more comprehensive error messages.
Re:A little bit of plain JavaScript can do a lot by adrianhel on Sunday June 21, 2020 @04:30PM (#23595147)
Why bother with jQuery? I don't see the value add anymore.
Re:A little bit of plain JavaScript can do a lot by tambourine_man on Sunday June 21, 2020 @05:01PM (#23595366)
Read this whole thread. People are rewriting it over and over again because it’s out of fashion.
Re:A little bit of plain JavaScript can do a lot by tonyedgecombe on Sunday June 21, 2020 @07:16AM (#23591353)
>Reimplementing gmail or slack in html/css/vanilla-javascript, without an "application frameowrk is no doubt an exercise in futility.

I'm pretty sure gmail started out without a framework.

Re:A little bit of plain JavaScript can do a lot by bigiain on Sunday June 21, 2020 @08:18PM (#23596398)
> I'm pretty sure gmail started out without a framework.

I'm pretty sure you're right.

I'm also pretty sure it's not only one of the big reasons frameworks exists as they do today (because it's perhaps one of the earliest and probably the most famous example of a web app that 100% _needs_ a framework for all the reasons discussed everywhere in this thread), but that it's also the poster child case of why every ambitious/opinionated/inexperienced FE dev builds their own framework (Of _course_ I can't use jQuery/Angular/React/Fluttr! _My_ ToDo list app is _groundbreaking and special_ - just like gmail was in 2004, I'll need to write my own framework for this. Stand back! <flexes>") ;-)

Re:A little bit of plain JavaScript can do a lot by e12e on Sunday June 21, 2020 @09:03PM (#23596596)
Isn't that where Angular comes from?
Re:A little bit of plain JavaScript can do a lot by rimliu on Sunday June 21, 2020 @06:33AM (#23591188)
And now we witness everyday spaghetti code written on the top of some framework and each noodle is wrapped five times in a needless abstraction.

There is nothing preventing you to write nice and clean code in plain JS.

Re:A little bit of plain JavaScript can do a lot by BigJono on Sunday June 21, 2020 @08:08AM (#23591572)
Yeah no shit. JS is the only community I've seen where code size scales with dependency count in the positive direction. It's ridiculous.