booksreddit.com:JavaScript: The Good Parts

JavaScript: The Good Parts

2624

I made FullScreenMario.com, now celebrating 2 million visits. AMA!
Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book scrapes away these bad features to reveal a subset of JavaScript that’s more reliable, readable, and maintainable than the language as a whole—a subset you can use to create truly extensible and efficient code.Considered the JavaScript expert by many people in the development community, autho…

More about the book on Amazon

Most upvoted comment

Most popular programming book on Reddit. rank no. 16

I made FullScreenMario.com, now celebrating 2 million visits. AMA!(r/IAmA)

I’m going to be brutally honest here, and I’m probably going to get down-voted, but I’m not impressed with the underlying code for the project. I don’t even know where to begin.

You’re obviously passionate about Javascript, but runtime engines and best practices have changed dramatically in the last few years. Some things that stick out could easily be chocked up to coding style or preference, but when those preferences aren’t well-adjusted to current-day standards, it leads to a perpetuation of those bad practices and hinders the growth and evolution of web development overall.

I’m posting this here, instead of on Github, because these aren’t quite bug reports. I’d be more than happy to contribute though.

  1. Syntax and readability are more important than shortcuts.

    Cutting corners in the interest of character count is useless. It’s better to be able to read the code than to have to interpret it line-by-line.

    For hinting, I recommend JSHint. It’ll be nicer than JSLint, but it’ll still likely hurt your feelings.

    Here are some JSHint errors/warnings that popped up:

    > The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.

    > Expected an identifier and instead saw ‘arguments’ (a reserved word).

    > Expected a ‘break’ statement before ‘case’.

    A lot of syntax errors can be solved by linting or hinting, and following a style guide. Here’s Google’s Javascript Style Guide. You’ll find that most projects on Github follow the same code conventions, and for very good reason. When you make your code consistent and readable, other developers will be more likely to like you and contribute to your projects.

  2. Read Douglas Crockford’s Javascript: The Good Parts and Nicholas Zakas’ Maintainable Javascript.

  3. Use an AMD-style, modular system like Require.js or Yahoo Module Pattern because Global variables are evil. The basic idea behind a modular system is that every piece of functionality is broken down to its basic form, and no less. It helps to keep things organized. Even if you choose not to use a framework, following a trusted organizational pattern is a good idea. Consistency is key.

  4. Check out Backbone.js or Underscore for data manipulation.

I really like the project, but the code is unwieldy and confusing.

Permalink

More details about a book.

Additional Information

Subreddits

learnprogramming,programming

Number Of Links

24

Sum Of Upvotes

404

Amazon Price

$14.36

Book Binding

Paperback

Type Code

ABIS_BOOK

Book Author

Douglas Crockford

Book Edition

1st

Book Publisher

O’Reilly Media

Book On Amazon

JavaScript: The Good Parts

Post Title

I made FullScreenMario.com, now celebrating 2 million visits. AMA!

Reddit Gold

0

Post Permalink

/r/IAmA/comments/1ou8ib/i_made_fullscreenmariocom_now_celebrating_2/

More about the book on Amazon