Live data from Hacker News

A Modern JavaScript Tutorial

javascript.info

111–120 of 299 posts

Re: A Modern JavaScript Tutorial

#111
post #46

The ninja code section is pure sarcasm, right? I'm not sure now which sections are and aren't.

It is hilarious. Lao Tzu quotes make it simply perfect.

It is funnier to me because the quotes are actual historical quotes (to be fair, there probably was no "Laozi" historically), whereas you see fake quotes for Laozi/Confucius/Buddha all over the internet.

Re: A Modern JavaScript Tutorial

#112

Earlier quoted context omitted.

Because it fails to meet the 'it's the platform stupid' maxim. ie languages aren't nearly quite so important as the platform. Stuff wasn't written in js because early js was a brilliant language - it was because the platform - the web - was brilliant. Many have written 'better' languages that compile to js - https://github.com/jashkenas/coffeescript/wiki/List-of-langu... and while typescript is one of the better, mor…

> Surely in the end it just adds complexity and fragmentation of the ecosystem? Lol. I switched to TS from pure JS a couple years ago and could never imagine going back. I am so much more productive in TS than JS: 1. Typeahead is crucial, and even when just working on my own projects it makes me much faster. 2. Refactoring is a scary nightmare in pure JS, but so much easier with TS. 3. I have yet to see any sizable,…

What text editor did you use before? I think the biggest advantage is an IDE, not the language itself.

Re: A Modern JavaScript Tutorial

#114

Earlier quoted context omitted.

I think many JS developers are also somewhat blind to the breadth of types of sites that are written, and so don't understand how valuable a type system can be on the web. Most websites are what I'd call "broad and shallow". For any individual action the corresponding code path is small. Most code in these sites is easy to write and easy to debug in vanilla JS. Typescript adds boilerplate and compiler times for type…

I'd guess I'd have to question why you need 10K lines of code for a single web page - perhaps you need to break up your SPA?

Do you think the Zoom web client should have fewer than 10k lines? Or be broken up? What about Google Docs?

Re: A Modern JavaScript Tutorial

#115

Earlier quoted context omitted.

I understand the power of types - I just wonder why the heck you are writing so much JS/TS code? Are you doing server stuff with it? You could argue here there are much better languages and platforms for that.

Have you seen the size of frontend codebases? Even modest SPAs reach into the tens of thousands of lines. Or the size of large Express.js driven backends? A huge portion of the web is driven by JS/TS.

>> Even modest SPAs reach into the tens of thousands of lines.

I still don't get how we got from fifty lines of code for a form with simple client side validation to a React/Vue/Angular/Next version that needs 100 different modules and a thousand lines of code to replicate. Why do people see this as a huge advancement in front-end development?

Re: A Modern JavaScript Tutorial

#116

Earlier quoted context omitted.

Because it fails to meet the 'it's the platform stupid' maxim. ie languages aren't nearly quite so important as the platform. Stuff wasn't written in js because early js was a brilliant language - it was because the platform - the web - was brilliant. Many have written 'better' languages that compile to js - https://github.com/jashkenas/coffeescript/wiki/List-of-langu... and while typescript is one of the better, mor…

I think many JS developers are also somewhat blind to the breadth of types of sites that are written, and so don't understand how valuable a type system can be on the web. Most websites are what I'd call "broad and shallow". For any individual action the corresponding code path is small. Most code in these sites is easy to write and easy to debug in vanilla JS. Typescript adds boilerplate and compiler times for type…

In before someone comments: "But chances are you are not the person who needs something as complicated as TS therefore it's useless." and "If your code is more than a thousand lines then you're doing it wrong, all code should be <1000 lines that you throw out immediately and replace with new code".

Re: A Modern JavaScript Tutorial

#117

Earlier quoted context omitted.

Amazing how many JS devs I meet (or work with) that are against the very idea of Typescript.

It's terrible. The amazing issues that TS can introduce to a codebase are terrifying, and TS has breaking releases on a regular cadence. As someone who has to do maintenance on a legacy TS platform it was miserable and literally involved flipping through TS versions to find one that worked. My issues are not with strongly typed languages, they're specifically with TS.

[deleted]

Re: A Modern JavaScript Tutorial

#118

Earlier quoted context omitted.

Have you seen the size of frontend codebases? Even modest SPAs reach into the tens of thousands of lines. Or the size of large Express.js driven backends? A huge portion of the web is driven by JS/TS.

>> Even modest SPAs reach into the tens of thousands of lines. I still don't get how we got from fifty lines of code for a form with simple client side validation to a React/Vue/Angular/Next version that needs 100 different modules and a thousand lines of code to replicate. Why do people see this as a huge advancement in front-end development?

Those libraries are providing a lot more than just simple validation though. Bunch of advanced validation rules, masking, etc. I'm sure if you dive into any of those modules you'd be able to see why. Not saying there isn't dependency bloat but it's not like people are creating these for the sake of it.

Re: A Modern JavaScript Tutorial

#119

Earlier quoted context omitted.

Have you seen the size of frontend codebases? Even modest SPAs reach into the tens of thousands of lines. Or the size of large Express.js driven backends? A huge portion of the web is driven by JS/TS.

>> Even modest SPAs reach into the tens of thousands of lines. I still don't get how we got from fifty lines of code for a form with simple client side validation to a React/Vue/Angular/Next version that needs 100 different modules and a thousand lines of code to replicate. Why do people see this as a huge advancement in front-end development?

Because people are writing applications, not forms. As software engineering has gotten easier, customers have demanded more complicated applications.

Modest SPAs do have a lot of code. So does a C++ Win32 application that calls into some central datastore. The complexity is not a byproduct of languages or libraries, but rather the customer's complicated needs.

Re: A Modern JavaScript Tutorial

#120

I looked at this page first and assumed that it was all a gag. https://javascript.info/ninja-code >Show your original thinking! Let the call of checkPermission return not true/false, but a complex object with the results of the check. >Those developers who try to write if (checkPermission(..)), will wonder why it doesn’t work. Tell them: “Read the docs!”. And give this article.

It was tongue in cheek though... the summary tells you as much.

I mean, I read it, and assumed the rest of the guide was also tongue in cheek.
Post reply on HN