Skip to main content

Discovering JavaScript Patterns

JavaScript Patterns by Stoyan Stefanov

I opened my mail this Wednesday and discovered that the book I've ordered "JavaScript Patterns" by "Stoyan Stefanov" had arrived. To my surprise it wasn't the concrete brick that I'm used to reading but a lightweight manual on how to improve your JavaScript code. I fell in love instantly. I work mainly in the backend of websites, with integration and data manipulation, but quite often this requires that I go up in the frontend and make sure that my backend changes are reflected to the user. This has made me an occasionally JavaScripter. A couple of weeks ago I started thinking about how to improve my JavaScript knowledge, how to test JavaScript and how to architect good JavaScript. Tens of thousands lines of JavaScript will do that to you. I got recommended this book "JavaScript Patterns" by a colleague.

The Review

I know the syntax and I have written quite a lot of code in my days. All I was interesting in was how to improve my JavaScript, how to structure the code and some do's/don'ts. It's exactly what this book is about. I usually read books where the first 50 pages is a "skip" because the author needs to thank his spouse and his sister from his other mother for making it possible to produce this block of concrete, but this book get right to the point and delivers value from page 1. That makes it very lightweight1. It only goes into specifics and does not try to teach us the obvious. If you want to learn the basic syntax of JavaScript, you should probably buy a beginners book also.

More tools for the hungry

Three tools that I'm going to take a closer look at.

  • JsLint
    Tells you whats wrong with your javascript code. Excellent! Works pretty much like FxCop or StyleCop. There's also a Visual Studio 2010 plugin that will evaluate your javascript at compile time.

  • YUI Docs
    API Documentation for javascript. I've always wondered how I should comment and document javascript code, and now I have a template to follow. Great thing that you can generate API documentation from the source.

  • YUI Compressor
    I've used this before - a tool for minimizing javascript. It can compress it down to about 50% of its original size, which is a real performance boost in page loading.

Watch out you frontend coders! You're starting to get obsolete when backend specialists gets their hands on literature like this!


Footnotes_


  1. I finished it in 2 days. 

comments powered by Disqus