Live data from Hacker News

Preparing Yourself for Modern JavaScript Development

codethinked.com

31–40 of 75 posts

Re: Preparing Yourself for Modern JavaScript Development

#31

That was a well-written article that has a pattern that should work well for a lot of people. But I think it can be improved. One cool fact is that Javascript has first class functions. This means you can bring a lot of development patterns from the functional realm into your web development. There is a trend of languages moving away from the concept of mutable state. The article does a good job with the first steps…

One time I saw a some code where the author re-implemented haskell in javascript. Needless to say reading that code was nearly impossible!

Re: Preparing Yourself for Modern JavaScript Development

#32

great post, thanks. i also highly recommend using popular frameworks and libraries, since lots of them use the tricks mentioned in your article. Another thing that's worth noting is the JSON Object Notation: http://www.hunlock.com/blogs/Mastering_JSON_(_JavaScript_Obj... very readable form of declaration.

"JSON Object Notation" => JavaScript Object Notation Object Notation

https://en.wikipedia.org/wiki/RAS_syndrome

Re: Preparing Yourself for Modern JavaScript Development

#33

Earlier quoted context omitted.

What's specifically wrong with RequireJS? I haven't heard much discussion of it, and you only addressed Browserify in your comment.

I've been following the work on RequireJS for two years and think that it's an evil project that sabotages the rise of CommonJS, NodeJS and NPM by leading client-side Javascript coders to follow a non-standard, awkward way of JS development. From the very beginning, it forces coders to cover their code with awkward code and maintain it manually. It's completely insane. I even think that I'm wasting my time by talking…

> it forces coders to cover their code with awkward code and maintain it manually

Friendly request for proof via examples. A gist would be fair.

Re: Preparing Yourself for Modern JavaScript Development

#35

Earlier quoted context omitted.

I've been following the work on RequireJS for two years and think that it's an evil project that sabotages the rise of CommonJS, NodeJS and NPM by leading client-side Javascript coders to follow a non-standard, awkward way of JS development. From the very beginning, it forces coders to cover their code with awkward code and maintain it manually. It's completely insane. I even think that I'm wasting my time by talking…

> it forces coders to cover their code with awkward code and maintain it manually Friendly request for proof via examples. A gist would be fair.

here; http://requirejs.org/docs/

you can see all the smelling shit of requirejs there.

Re: Preparing Yourself for Modern JavaScript Development

#36
> Spy.prototype = new Person();

Don't do it that way. If the Person constructor assigns any data, for example an array, that data will be shared with all instances of Spy. Most likely you don't want that. Instead call the Person constructor within the Spy constructor:

  function Spy() {
    Person.apply(this, arguments);
  }

  Spy.prototype = Person.prototype;
  Spy.prototype.constructor = Spy;

Re: Preparing Yourself for Modern JavaScript Development

#37
post #25
post #23

Earlier quoted context omitted.

> I always find it odd that the same developers who deride PHP look at things like IIFE and think "wow, JS is a cool, modern language!" I don't deride PHP (I don't know it), but I see nothing wrong with IIFE. Yes, it could benefit from some syntactic sugar, but otherwise it is just using one of the best features of JavaScript, function support (first-class functions, anonymous functions, etc.). It makes perfect sense…

IIFEs are cumbersome and non-intuitive. Better languages have block scope or a "let" statement instead.

`let` is drafted for ECMAScript 6.

Re: Preparing Yourself for Modern JavaScript Development

#38
post #28

Earlier quoted context omitted.

Exactly my thoughts. There really needs to be some healthy competition in client side languages.

Oh definitely. Or rather we need a vm designed to write code that can be optimized to run fast (personal dream, allow me to optionally include typing information. I already type my JS, might as well make it run better). This means that the vm would be lowlevel enough that performance would start to approach that of native code, with complete freedom for the programmer to write the code for it in any language he desir…

You'll be disappointed to know that Dart doesn't use bytecode.

Re: Preparing Yourself for Modern JavaScript Development

#39
post #20

Earlier quoted context omitted.

The Crockford book is 4 years old now, is it still considered to be a good book to pickup? I've done JS off and on for a while, but mostly haphazardly (with an emphasis on the hazard). I'm looking to start doing some backbone.js and jquery and a book to help start off with it.

If four years would be enough to change a lot about the core JavaScript language, there wouldn't be a need for the book in the first place. It's still quite modern enough, and will be until a major EcmaScript overhaul is propagated and accepted by all common browsers… It's not about modern web techniques, which is why it aged that well. For those, I'd personally recommend pulling apart some modern webapps or librarie…

And if you want more of Crockford's advice, he's done a talk about ES5 changes (which you should really watch, they are great)

Re: Preparing Yourself for Modern JavaScript Development

#40

> Spy.prototype = new Person(); Don't do it that way. If the Person constructor assigns any data, for example an array, that data will be shared with all instances of Spy. Most likely you don't want that. Instead call the Person constructor within the Spy constructor: function Spy() { Person.apply(this, arguments); } Spy.prototype = Person.prototype; Spy.prototype.constructor = Spy;

Dude, that's a pretty awful way to do it. After running your example code:

    (new Person).constructor === Spy
Post reply on HN