r/programming • • Oct 03 '16

How it feels to learn Javascript in 2016 [x-post from /r/javascript]

https://medium.com/@jjperezaguinaga/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.758uh588b
3.5k Upvotes

852 comments sorted by

View all comments

479

u/Retsam19 Oct 03 '16 edited Oct 03 '16

You really just need one thing to survive in the modern JS ecosystem - basic engineering common sense:

  • Don't use a tool until you need it.

  • Don't use a tool just because it's what all the "cool kids" are using.

  • The bleeding edge is fine for small projects and hobby projects, but bigger projects should stick to tried-and-tested solutions.

I don't really know why people ignore these then blame it on the JS ecosystem.

All of these tools and technologies exist because they're useful for dealing with specific problems: but if you're only using them because some Rockstar Ninja Coder told you that it was the One-True-Path-to-2016-JS-Nirvana, you're not going to appreciate what they bring to the table.


My advice to new JS programmers is to start out simple: vanilla JS, CSS, HTML, and solve problems as you run into them.

If you find the DOM API is obnoxious? Try jQuery (ignore the JS hipsters like me who say you don't need it. You don't, but if it helps you learn, go for it).

Maybe you decide you want more powerful CSS, so you drop in LESS or SASS: that'll lead you towards adding a build tool like grunt or gulp, and you'll understand why you need it, instead of doing it because someone told you to.

You'll eventually find adding all of your dependencies as <script> tags obnoxious, too, and that'll lead you to a module system.

As the project gets larger, odds are you'll start to see the advantages of static analysis tools like Typescript and eslint, too.

164

u/i8beef Oct 03 '16

Agree on all points... except that EVERY tutorial on every one of these frameworks will inevitably have this line in it's instructions: "Don't worry about what this does, just add these 15 packages". At best you get a one liner like "lets us compile SASS", but then never explains how the black magic under the hood does that. This eventually leads you to accepting this "it just works" up until it doesn't, and then its a rabbit hole of frustration.

Your method here is a GREAT way to learn what's happening, but so few tutorials are structured this way. I pretty much nope out of every tutorial that starts with "download this starter template that is already setup with no explanation" or "run this neat NPM script we wrote that initializes an environment for you". Tools are good for advanced people who know what they are doing as a shortcut, but if you DON'T know what they are doing because you were never told, or never had to do it the "old" way without the tool, then its very frustrating.

Couple that with the "no, we don't use grunt anymore, it's all gulp no.... wait sorry, we just changed to npm scri... wait sorry, it's npm scripts and webpack now" bullshit, and it gets a little obnoxious.

44

u/youssarian Oct 04 '16

"Don't worry about what this does, just add these 15 packages"

This kind of thing always makes me a little suspicious. Why am I downloading those packages? What do they do? Why do I need them? Why so many? Hasn't someone come up with a way to streamline those into one or two packages? Sometimes it feels like it's bloat for bloat's sake.

15

u/8483 Oct 04 '16

Left pad inc.

5

u/youssarian Oct 04 '16

I had to google that, but a blog post titled Have We Forgotten How To Program? voices my opinion well.

Maybe I'm just too much of an "I want to do it all myself" kind of guy. But if a function that adds whitespace becomes so critical that its absence brings down applications, what are we really doing with ourselves? Maybe I'm not sufficiently experienced with things like NPM, but I see tutorials saying download this, that, these, those and so on, and I can't help but feel it's a Frankenstein of an application. There's an adage many a teacher has taught me, and it seems like we're losing touch with it: "Keep it simple, stupid."

→ More replies (1)

5

u/HighRelevancy Oct 04 '16

I bet someone could "hack the internet" by simply writing a few tutorials that claim to require a library with some unecessary remote control system in it.

2

u/[deleted] Oct 04 '16

Software development is built on abstractions. There will always be a lower layer that you're not going to understand.

Would it really make you feel better if someone took a couple of libraries and combined into one super-package?

2

u/youssarian Oct 04 '16

Honestly... yeah, it would. Because at least then there's be the appearance of it not just being a hobbled together clump of code. Plus if there are any unnecessary components, then perhaps those could be pruned out.

→ More replies (1)

11

u/mikejoro Oct 04 '16

You can't read a tutorial and expect to become an expert at modern Javascript technologies and build tools. Just like you can't read a java tutorial and understand all of Java, gradle/maven, spring, etc. Same with any other stack. You have to work with those technologies over a period of time.

People are used to Javascript being this thing that is sprinkled into pages for interactivity, and for lots of websites, that all you need it for. But most people don't want a job as a wordpress dev, they want a job with a larger company which is going to need a more complex application.

People should stop trying to learn "1 cool framework vanilla js devs hate" and just learn how to program in Javascript. Then, once you actually understand how Javascript works as a language, sprinkle in some of those technologies as the OP recommended. Unfortunately, that takes either a longer period of time to do than most people have patience for, or it takes a large commitment of free time.

6

u/i8beef Oct 04 '16

But that's the point, people ARE trying to learn, but the ecosystem has jumped the shark in it's bid to grow up into a real development environment. The problem is, as you point out, the churn is SO bad right now, that it isn't easy to learn JS like we used to. Just keeping up is a full time job at this point, and most of us are gainfully employed needing to actually build something with this stuff, and don't have time to deal with that churn.

From the tooling side, it's great the JS ecosystem is starting to grow up, but it's like the entire community has ADHD or something. You don't get to actually learn a stack, you get to learn what the particular dev whose tutorial you are following liked at the time of that writing, but 4 weeks down the road it's all deprecated. I'm not even sure 90% of the tutorials understand their OWN tools.

Another perfect example is the state of React / Redux and ES6 / ES2016 / ES2017. There are 5 or 6 different ways to write components now, and not even a recommendation on which of those ways is the best way to write them right now. So every tutorial is different, and you can't even jump in between tutorials and keep a train of thought. Each one does things DIFFERENTLY which is a huge hindrance to learning.

Here's another: WebPack, requirejs, ES6 modules, AMD, etc. Shit, how does WebPack even work, their documentation is shit.

You're right, JS had grown up into it's own, real development environment. Most of us complaining are probably full stack devs who have to keep up with our chosen development world, and JS was always this fringe element along with HTML and CSS that you had to know, but didn't have to spend much time on, and now it's just as complicated, if not more so because of the churn, than our real dev environments. Hopefully some of it will calm down, and hopefully the community will start laying down some actual standards instead of it being the wild west like it is now.

→ More replies (3)
→ More replies (2)

37

u/youssarian Oct 04 '16

I'm seeing people say that jQuery is "outdated" or "out of fashion." I'd really like to know when the hell this happened, because I've never heard anyone IRL say that. jQuery has issues like literally any other library, but it's damn good.

18

u/PrintfReddit Oct 04 '16

Between document.querySelectorAll and fetch, I haven't really needed jQuery in a long time.

2

u/basilect Oct 04 '16

Doesn't safari (even V10) not have fetch yet?

→ More replies (4)
→ More replies (4)

72

u/nebbly Oct 03 '16

While those principles are solid in any language, the small JS standard library means that you have to reach for third-party tools more frequently than in many other languages. In that way, JS itself propels devs (especially new ones) to not abide by those principles.

25

u/Retsam19 Oct 03 '16

Ehh, I don't find myself reaching for third-party tools all that often, despite the admittedly small standard library. I think JS gets away with a smaller standard library, because it's inherently a more focused language.

I'm a big fan of lodash (though I suspect I'll be joining the Ramda hipsters, eventually), and I can still see why a lot of people find jQuery's api's indispensable, but even then it's not too painful to get by without them, nowadays.

I don't think the over-reliance on third-party tools is really an aspect of the language itself, I think it's just a symptom that the average JS developer isn't a disciplined engineer.

34

u/nebbly Oct 03 '16

I'm a big fan of lodash (though I suspect I'll be joining the Ramda hipsters, eventually), and I can still see why a lot of people find jQuery's api's indispensable, but even then it's not too painful to get by without them, nowadays.

Sounds like you're saying that lodash and ramda are third party tools you like to use because they provide functionality that you benefit from, while simultaneously saying devs should hesitate to use them. Imagine if a lot of the utilities in lodash, for instance, were part of the JS standard library. Then it would be easier for devs to not reach for third party tools. So, you're giving a perfect example of the small standard library pushing you to use third party tools.

To be fair, I do agree that ES6 has filled a lot of gaps (by expanding the standard library).

the average JS developer isn't a disciplined engineer.

I'd hesitate before categorizing huge swaths of developers. If developers of a language tend to be sloppy, it's usually because the language allows it.

21

u/Retsam19 Oct 03 '16

So, you're giving a perfect example of the small standard library pushing you to use third party tools.

My point was pretty unclear there, I was specifically listing lodash as a rare exception. Yes, it's a case where it's got functionality that I find useful, and sure, some of that functionality could go in the standard library; but it's the exception, not the rule, in my experience.

And a lot of lodash is now in the standard library already; part of it's popularity was as an ES5 polyfill, and even more of those features have been polyfilled with ES6 and ES7.

It's a small standard library, but I really don't see too many large holes in it, at this point.

I'd hesitate before categorizing huge swaths of developers. If developers of a language tend to be sloppy, it's usually because the language allows it.

I think it's a pretty well-recognized fact that JS programmers on average are less experienced than most languages. Part of the beauty of JS is that it has an amazingly low barrier to entry: I started programming JS on the school computers in high school, because I couldn't install a Java compiler, but I could write HTML/JS and open it in a browser.

And then there's all the people who start as designers; the graphics design sort of people who learn some JS to add bits of functionality to their websites and transition over to development that way.

The low-barrier is great, really; I'm not trying to be condescending or exclusionary about "these sort of people shouldn't be programming" (I was one of them, after all); but the fact that so many JS programmers simply don't have the engineering background or the experience is definitely something that needs be remembered when looking at the JS ecosystem.

4

u/levir Oct 04 '16

the average JS developer isn't a disciplined engineer.

I'd hesitate before categorizing huge swaths of developers. If developers of a language tend to be sloppy, it's usually because the language allows it.

It's true, though it should say the average developer isn't a disciplined engineer.

→ More replies (3)

7

u/[deleted] Oct 04 '16

Thanks for this comment, saved it. I've seen pieces of this advice all over the place but not gathered together so nicely and succinctly. As someone just over a year out of college about to leave my corporate behemoth, mostly back-end role for (fingers crossed, almost through the interview process) a much smaller, much more web/front end focused role, I'm sure I'll be referring back to this.

5

u/UnchainedMundane Oct 04 '16

Try jQuery

I feel like it's worth mentioning wherever this is, that if you like jQuery for its $('blah') selectors, you can do that with normal javascript with document.querySelector('blah') and document.querySelectorAll('blah').

Of course there are many more reasons you'd want to use jQuery, but I feel like selectors would be a big one.

4

u/SquareWheel Oct 04 '16

Glad to see a sensible comment high up. This is exactly the approach devs should be taking to the JS ecosystem. Use tools because they'll add value for you, not because they're trendy.

3

u/[deleted] Oct 04 '16 edited Nov 09 '16

[deleted]
0.7323

What is this?

6

u/pucado Oct 03 '16

This. Front End has ended up becoming so overtly complicated that the best way to learn is YOUR way and not by a friend or an advisor (unless you know by having worked with them before they are truly lazy and have the shortest way out of things) and then build your Front End technique moving forward.

2

u/RagingCain Oct 04 '16

You can do everything in JS, CSS, and HTML.

I do recommend one plugin library, JQuery - mainly for the simplification. I don't care what year it is.

2

u/blukkie Oct 04 '16

Exactly how I use Javascript. I've been working with it for a year now, and only slightly touched jQuery and used Typescript to create a game for a school project. This website also really helps if you want to avoid using jQuery http://youmightnotneedjquery.com/

→ More replies (15)