3 ms·
Timeline of learning JavaScript 1. Constructer's are great it's just like language x 2. uncanny valley of realizing it's not actually like language x 3. unde
by cwmma 12y ago
Timeline of learning JavaScript
1. Constructer's are great it's just like language x
2. uncanny valley of realizing it's not actually like language x
3. understanding constructors, use them everywhere
4. get burned by subtler points of this in async functions and forgetting new, decide to go all functional all the time
5. have enough experience to avoid the foot guns, use constructors all the time as they tend to be the fastest method and have the best support.
This article is at stage 4
- Havvy 12y agoIt's not async functions, it's first class functions. Having multiple ways of calling a function doesn't compose. I have enough experience to know where the foot guns are at, but I don't like writing code that has foot guns in them. It's like `null` in Java. "Remember to check for null before using every object". "Remember to use new before every function that instantiates an object.". I'd rather programmers quit creating new classes of errors in languages for 'programmer convenience'. Object creation has not yet caused my any performance issues, so I've not seen a reason to personally use `new`.
- erikb 12y agoI'm not a JS guy, but when I read articles about Python or VIM here on HN I often want to write comments like yours. I still have a hard time accepting that after 5 the number 6 will probably be much closer to 4 again, just with more nuances.
- cwmma 12y agoNumber 6 would probably be confidence in when it's not a performance bottleneck to not use constructors some of the time.
- regularfry 12y ago6. Be Douglas Crockford. http://www.youtube.com/watch?v=bo36MrBfTk4&t=19m http://www.youtube.com/watch?v=bo36MrBfTk4&t=19m I believe he has some experience of JS.
- insin 12y agoArgument From Cranky Authority (Whose Lawn You Are On)
- regularfry 12y agoPossibly, but it does rather blow a hole in the argument that only people with limited experience in JS would treat `new` as a footgun.