Live data from Hacker News

How to Become a Great JavaScript Developer

blog.ustunozgur.com

61–70 of 171 posts

Re: How to Become a Great JavaScript Developer

#61
post #26
post #8

The best thing that happened to me as a JavaScript developer was being exposed to other languages. Especially the not-so-fancy Java and C++, really opened my mind about structuring code and planning for a long-term project. Knowing JavaScript and JavaScript frameworks is surprisingly useless for the type of work JS devs usually handle. The documentation often consists of TodoMVC type of examples and approaches. Hardl…

I agree a lot with it. I also think it's useful to work with at least one statically-typed language (like Java for example) because it teaches some good maintainability practices. In JS world, I've seen far too often creating objects in random places, as a map of parameters, passing them around, and injecting new keys to the object in other random places, and when such an object goes around too much and is augmented…

I enjoy the freedom to use a map/object/parameter object as named parameters, speaking as somebody who has suffered through much Java ceremony.

That said, JSDoc helps a lot: make a @typedef comment for parameter objects at the top of a file, then use the type in the @param annotations of the relevant functions. Makes understanding the JS code in an IDE much easer, as well as having something worth generating HTML documentation from.

Re: How to Become a Great JavaScript Developer

#62

I've never learned JS completely, just dangerous half knowledge from stackoverflow answers or blogs. Should I jump into ES6 directly or learn ES5 and learn ES6 when it is implemented across all browsers ?

This is sort of like asking should you learn Swift or Objective-C, albeit much less difference between syntaxes. You can certainly get the job done on ES6, and the future is certainly in that direction, but all browsers still run ES5, so if you want to get paid for your work, you'd need to still know that syntax.

Babel is a great tool to let you use some of ES6's features now, but it will still help in debugging to know ES5 syntax since Babel transforms it at runtime.

Re: How to Become a Great JavaScript Developer

#63

Just adding my two cents. Wanna be a good JS dev? Go play around with a lisp. Like Clojure for a month or two. Get comfortable with functional programming. Then come back to JS. So many people come from a OOP to JS and they have a bad time with it. JS is more like a lisp with C syntax than it is a traditional OO language. Learning Clojure, not only improved my JS abilities, but just my over all programming maturity.…

I totally agree.

If you've only been exposed to OOP, and you don't have the bandwidth for learning an unrelated language, then start using a functional library like Underscore. Just use it everywhere, even if you think it's ridiculous. Don't use for-loops, use _.each. Try to think of every problem in terms of chaining map, reduce, zip, pluck, groupBy, etc. Do whatever you can to avoid side-effects.

Once you're comfortable with it, try reading "Functional JavaScript".

You'll quickly develop a taste for when OOP or functional is appropriate, but I think the best way to get to that point is to immerse yourself in functional programming first, which might mean writing some ridiculous functional stuff, but the long-term payoff will be worth it.

Re: How to Become a Great JavaScript Developer

#64
I definitely do not consider myself great JavaScript developer. Not even mediocre. Code by some people that now do JavaScript lectures, I've refactored and made at least order of magnitude faster, so there's that.

There's one important thing I've already learned though and I'll do you a solid - be a total nazi to your code.[1]

At the start, it's easy to get impression that it's all loosey-goosey-everything-works kinda thing, and it actually is...at small scale! When you get to medium-sized thing, all hell starts to break loose, and I'm not talking just callback hell. You can avoid all that with modest amount of discipline.

I'm aware many people have qualms with JSLint, some even with JSHint. But it doesn't matter what you use as long as you keep consistency. Those two tools help you with that. If you can be disciplined without it, sure, go for it. Just reading on possible configuration options for JSHint already made me consider many potential pitfalls I wouldn't have even thought of otherwise..

As far as learning goes, I'm definitely recommending learning as-you-go. To hell with academics - this is JavaScript, language made in few weeks[2]. You can develop amazingly accurate feel for the language in spite of not knowing rigorous abstracts. You're not sure what new actually does, and you're on deadline? Make a note - "figure out new" - and move along. When you manage to scrounge few hours of your busy week, run through those questions of yours across plethora of amazing resources online, head over to #Node.js or ##javascript on freenode, ask and ye shall receive.

In JavaScript, there's about a million ways one can make something work, an immense solution space. Are you sure your attack vector is good enough? Refactor aggresively!

[1] I wanted to go with "anal" instead of "nazi". But you get the idea.

[2] ...by some amazing dude though.

Re: How to Become a Great JavaScript Developer

#65
I think that setting up a test environment is one of the bigger hurdles (it seemd more confusing for JS than for most other languages I used before). Starting with installing node and "node myfile.js" is pretty good to get going (writing hellow world, fizzbuzz etc.). I struggled quite a bit sifting through all the options after that (e.g. npm+Grunt+Browserify to be able to require stuff etc.). Maybe I'm imagining things but the simple "getting started" was quite complex for JS. Or in other words...the first steps are pretty hard imo.

The inclusion of Backbone seems a bit odd. Isn't that also frontend-ish (like the pick one of Ember,React,Angular). I'd rather substitute it for Express.

Re: How to Become a Great JavaScript Developer

#66
post #46

Earlier quoted context omitted.

Why oh why are those not comments within the source file? It would help me so much to have comments like those in software... Generally I think that a linear step-by-step description is often not the best way though, often you would have to explain concepts or the bigger picture first.

You're in luck. Those comments certainly are within the source file: http://underscorejs.org/underscore.js

That's fantastic! I guess the website was auto-generated then, how nice.

Re: How to Become a Great JavaScript Developer

#67

Just adding my two cents. Wanna be a good JS dev? Go play around with a lisp. Like Clojure for a month or two. Get comfortable with functional programming. Then come back to JS. So many people come from a OOP to JS and they have a bad time with it. JS is more like a lisp with C syntax than it is a traditional OO language. Learning Clojure, not only improved my JS abilities, but just my over all programming maturity.…

THIS!

JSON starts to look like funny s-expressions.

JS brings a lot more to the table than just a scripted version of "C++ for retards" (aka Java), as it also lets you make use of many FP concepts like higher order functions and functional (vs object) composition.

For example, using currying (aka "dependency injection for functions") lets you often do with a single function what would take a silly-long class to do in Java. Use currying to inject leading parameters to a function that would normally be in the constructor (or setters, ugh) in a Java class, then the remaining "short arg list" function acts like the oh-too-common one actual "we're ready, now do something" method in a class.

Re: How to Become a Great JavaScript Developer

#69
post #60

Earlier quoted context omitted.

For the decent developers picking up Javascript, http://learnxinyminutes.com/docs/javascript/ is hard to beat. All the basic syntax and language features in one page without trying to explain to you what a while loop does.

This made me gag, years ago: // Statements can be terminated by ; doStuff(); // ... but they don't have to be, as semicolons are automatically inserted // wherever there's a newline, except in certain cases. doStuff() // Because those cases can cause unexpected results, we'll keep on using // semicolons in this guide.

I haven't gotten much into Javascript yet, but is there any reason I would not terminate with semicolons? Without understanding which "certain cases" won't have them inserted automatically, relying on that feels like asking for trouble.

Re: How to Become a Great JavaScript Developer

#70

Just adding my two cents. Wanna be a good JS dev? Go play around with a lisp. Like Clojure for a month or two. Get comfortable with functional programming. Then come back to JS. So many people come from a OOP to JS and they have a bad time with it. JS is more like a lisp with C syntax than it is a traditional OO language. Learning Clojure, not only improved my JS abilities, but just my over all programming maturity.…

> JS is more like a lisp with C syntax

Indeed, so the tale goes: Brendan Eich was originally going to make Scheme for the browser, but Netscape said their browser language had to look like Java, and that's how we wound up with this odd vaguely-functional browser language called Javascript.

In light of that, definitely seconded. Using Clojure (and watching Rich Hickey's amazing talks) made me a much better developer, and especially a better JS developer.

Somewhat relatedly, one thing I personally like about CoffeeScript is that it really lets the functional, Lisp-y side of Javascript shine through by melting away all the crufty syntax. That really helped me apply some of the style I picked up from Clojure.

Post reply on HN