Live data from Hacker News

JavaScript for Impatient Programmers

exploringjs.com

51–60 of 104 posts

Re: JavaScript for Impatient Programmers

#51

My "real" advice for impatient programmers: just start programming, and every time you encounter a problem google it. Don't know how to setup node.js? Google should lead you to `npm init` or a starter. Getting some weird syntax error? Google it. Once you learn the basics, want to do X? Google it and determine a) how to do X, or b) if X can't be done / is bad practice. Just by diving head-first into whatever you're tr…

You cannot just google your way through it. There are times when you don't even know what to google. I remember as an early beginner being stuck with something that had to do with closures. I had no idea what was going on and didn't know what to google and when I asked questions on stackoverflow and reddit please started saying things about decorators and whatnot!!! It is only when I sat down and went through some ki…

Usually I just take a quick glance at, and/or try of the main features of a language in some REPL or toy program, _then_ will jump straight to developing something to it and Google/DDG my way through. I do agree that just Googling your way through without having a basic grasp of the general philosophy and main tools a language puts at your disposal can be counterproductive.

Re: JavaScript for Impatient Programmers

#52

My "real" advice for impatient programmers: just start programming, and every time you encounter a problem google it. Don't know how to setup node.js? Google should lead you to `npm init` or a starter. Getting some weird syntax error? Google it. Once you learn the basics, want to do X? Google it and determine a) how to do X, or b) if X can't be done / is bad practice. Just by diving head-first into whatever you're tr…

How much time would you say is fast enough to build a full front end and back end login/authentication system in nodeJS with any db ? I mean including throttling, pwd reset, forgot email/pwd, 2fa, confirmation email etc? Most of the tutorials are notoriously outdated and won't work bc dependencies, but I have build one such app. For someone who knows the J's basics , I mean

I wouldn't because all of that comes out of the box with laravel.

It would take 5 or 10 minutes (npm install taking up the majority of that time)

Re: JavaScript for Impatient Programmers

#53
HN: Is today's hectic javascript making you tense and impatient? Me: Shut up and get to the point! Yeah, it's a futurama quote

On topic: This is quite a list so I just clicked a random link and voila:

> 7.1.1.3 Assertions

> An assertion describes what the result of a computation is expected to look like and throws an exception if those expectations aren’t correct. For example, the following assertion states that the result of the computation 7 plus 1 must be 8:

> ...

> assert.equal(7 + 1, 8);

> There is also assert.deepEqual() that compares objects deeply.

What? Am I going crazy? Have my years of wild hedonism finally caught up with me? I don't see jest mentioned but fired up my browser's console and sure enough, there is no "assert" in my window. What am I missing here?

Re: JavaScript for Impatient Programmers

#54
post #53

HN: Is today's hectic javascript making you tense and impatient? Me: Shut up and get to the point! Yeah, it's a futurama quote On topic: This is quite a list so I just clicked a random link and voila: > 7.1.1.3 Assertions > An assertion describes what the result of a computation is expected to look like and throws an exception if those expectations aren’t correct. For example, the following assertion states that the…

"7.1.1.3 Assertions .... It is part of a Node.js assertion API that is explained later in this book."

Re: JavaScript for Impatient Programmers

#55

My "real" advice for impatient programmers: just start programming, and every time you encounter a problem google it. Don't know how to setup node.js? Google should lead you to `npm init` or a starter. Getting some weird syntax error? Google it. Once you learn the basics, want to do X? Google it and determine a) how to do X, or b) if X can't be done / is bad practice. Just by diving head-first into whatever you're tr…

> "My "real" advice for impatient programmers: just start programming, and every time you encounter a problem google it."

In my experience, this is a terrible advice. However, many of my students follow this advice over my protests and only a handful of them actually learn anything at the end of a long masters program.

Re: JavaScript for Impatient Programmers

#56

My biggest hurdle with JavaScript was getting things to happen in order. Functions can be unexpectedly colorful[0] and contortions and boilerplate is needed to deal with that. What was unintuitive to me was a lot of interactions with the DOM are asynchronous without being explicit about it. So you've got to chain a bunch of asynchronous calls together to make sure a sequence of events occur. Most other languages make…

Do you have an example of a DOM operation that is async ?

Creating a new element on the DOM, especially when it is creating a new script element. It takes non-zero time to load and parse but returns control to JavaScript immediately. So you need to wait on the element with like onLoad before calling a function in that script. There's some more instances I've forgotten.

The situation is better now with promises but it was a pain in the ass just a few years ago.

Re: JavaScript for Impatient Programmers

#57

My "real" advice for impatient programmers: just start programming, and every time you encounter a problem google it. Don't know how to setup node.js? Google should lead you to `npm init` or a starter. Getting some weird syntax error? Google it. Once you learn the basics, want to do X? Google it and determine a) how to do X, or b) if X can't be done / is bad practice. Just by diving head-first into whatever you're tr…

Googling how to install nodejs you'll end up with a bunch of nonsense from how to manually set it up to how to do it using some OS specific thing that won't work right when you need to upgrade and everything in between when the best practice is installing 'n' which is a node version manager and does everything for you.

Re: JavaScript for Impatient Programmers

#58
I got my start in programming in the early 2000s with Perl and, shortly after, PHP. I went through school mainly with C++ and Java and got a job as a .NET developer after.

I say all this because I fucking hated JavaScript with a passion. From the time of my initial foray into programming until my later years, I hated it. It was always a joke of a language that, honestly, caused me to develop such a bias that I nearly refused to use it, for a very long time.

Several months ago I decided to put my prejudices aside and began playing around with Nodejs and React. The main motivation was trying to learn more about front end development and guess what? I really enjoy JavaScript.

JavaScript is a very enjoyable language to play with. It has come such a long way despite, literally, all odds. The ecosystem is scattered. The build system is the most hacky monstrosity you’ve ever encountered. But, that’s one of the reasons I love it. It feels like the essence of what I feel when I imagine hacking.

And not only that, it uses a unique (at least to the paradigms I’m used to) execution model that is very performant.

These are just a lot of words for me to say I love JavaScript.

Re: JavaScript for Impatient Programmers

#59

I got my start in programming in the early 2000s with Perl and, shortly after, PHP. I went through school mainly with C++ and Java and got a job as a .NET developer after. I say all this because I fucking hated JavaScript with a passion. From the time of my initial foray into programming until my later years, I hated it. It was always a joke of a language that, honestly, caused me to develop such a bias that I nearly…

I dunno… I started around the same time as you, also with PHP. I posted this comment[0] the other day where I tried to put into words how much I hate JavaScript and, judging from the reactions I got, it seems the community is pretty split on this one.

[0]: https://news.ycombinator.com/item?id=29193470

Re: JavaScript for Impatient Programmers

#60
post #41

I really don't understand why people hate JS so much. I myself a primarily a JS dev, and now a TS dev. TS made the experience so much so much better. JS is like pretty much a programming language for average software engineer like me. Sure, JS build system is a pain. I am the go to build system guy for almost every company I've been with, I worked with Grunt, Gulp, Webpack 1,2,3,4 and etc and yes I hate it, but other…

> Async is easy as well. An off-topic question: how do modern development practices using async code avoid race conditions and intermittent heisenbugs?

It's a great question. JS is single threaded (modulo web workers), which eliminates an entire class of race conditions: data races. That means mutices kan be skipped and channels can be replaced with a reqular fifo queue.

Async doesn't change any of this, and is mostly syntax sugar for callbacks. However, there are of course logical race conditions so when you use async you must be aware that the entire world can have changed after an await.

Post reply on HN