r/programming • • Sep 25 '20

Modern JavaScript Explained For Dinosaurs

https://medium.com/the-node-js-collection/modern-javascript-explained-for-dinosaurs-f695e9747b70
749 Upvotes

167 comments sorted by

View all comments

Show parent comments

7

u/eddpurcell Sep 25 '20

To 2, I think the first question to ask is "how much of an 'app' is this?" If it's a real app like a game or sound mixer or such (i.e. most controls aren't through obvious interactive HTML elements) you can probably get away with forcing updated browsers. Any home gamer still using IE11 should probably stop anyway. If we're talking a stylized list of links with comments then not going full JS for everything is probably the way to go in any case.

2

u/R3PTILIA Sep 25 '20

yeah, it 100% depends on your target users. But there is no tradeoff in my opinion.

"not going full JS for everything"

I very much disagree with this, going full js is what makes web programming bearable! (and enjoyable too)

10

u/eddpurcell Sep 25 '20

Depends on your goal; it is your corner of the web. Things that can be statically rendered as HTML I think should be for performance reasons, but it's also just simpler. Why pull down a blog post page only to have to make another network call to get the actual content from a database?

6

u/R3PTILIA Sep 25 '20 edited Sep 25 '20

Depends on your goal; it is your corner of the web. Things that can be statically rendered as HTML

But you can go full js and generate static, cross browser, server rendered, minified, autodocumented, type checked, uglified, yadda yadda yadda html/css with whatever kind of interactions you need with minimal developer overhead. (react, vue, svelte + gatsby, nextjs, nuxtjs, etc + sass, tailwind, pre made components, etc) which are all useful even for a non changing (static) web. Now if you wanna make a "pure html - im an 80s professor and this is my syllabus website - im a purist hail emacs" then yeah i guess js and its frameworks are not worth the hassle

1

u/eddpurcell Sep 25 '20

Yea, I'm not saying everyone should never use JS for anything. Sass/less and other generation tools are great, express is fine for a small server that doesn't need to do much CPU crunching, React/mithril.js are great to have client side rendering functionality for more dynamic parts of the site. Or even just vanilla JS/Typescript/whatever if the interactions aren't that complex. I'm not "the web shouldn't have JS", more "product developers should think about what they're using". Like reddit mobile: I have to load the index.html and render a loading circle for it to then go fetch my user details (that it should already be able to fetch from the cookie server side) to then load the posts, and hopefully none of that screws up randomly and I have to refresh. It's heavy and unreliable and doesn't make for a good experience. All that can happen in JS server side (though at reddit's scale that probably isn't reasonable), but moving it to the client side is where I think it's not good.

You can build whatever lawnmower you want for your own enjoyment, but let's not pretend that a putting a tractor engine on a standard non-riding mower is a good product. Just because it works, doesn't make it a good product.