Martynas Bardauskas

Martynas Bardauskas

Reading

It pays off to have a few days off (or weeks) without a constant internet connection to catch-up on other things you always wanted to do. One of those things for me was reading JavaScript books I have on my kindle for quite some time now. Particularly I wanted to finish reading “JavaScript: the Good Parts” by Douglas Crockford.

The book was preached by the people who read it and recommended it to me, though for me it did not live up to its name. Some of the content seem outdated and the methods seem to be controversial. If you are constantly reading up and following what’s new in JavaScript world, you might feel the same way after reading it. Nonetheless, it had useful parts for me.

One of the most useful tips was using self-executing anonymous functions to return objects instead of the prototype approach. This claims to solve special variable “this” problem for your methods and hides information you do not want to expose. If I am not mistaken, TypeScript does the same thing to have private variables. In other words, it was not entirely new, though I was more used to using the prototype approach and had the slightest idea which is better and why.

Another useful part seemed to be an example for event functionality for objects. This might be a handy boilerplate code for building event based application in Vanilla JavaScript. Highly unlikely I guess, though still interesting and worth a read.

The book has a good chapter on Regular Expressions. The problem is there are quite some things to remember (regarding Regexp itself), so I usually work with the manual and some 3rd party tool to explain on the fly exactly what the expression does. Sort of proof-reading not to have something unexpected along the way. Saves loads of time. Definitely worth a read, something will stick with you anyway.

Definitely the best part of the book for me was the appendixes. No wonder it’s one third of the book. There are three appendixes, one for awful parts which should never be used. Another for bad parts which should be avoided. Both of them are in depth and explain hows and whys. The last part is about JSlint - will definitely have to look up my settings in IDE once I’m back at work.

Conclusion

I am not sure whether I would recommend it to a friend. Especially after I started reading “Maintainable JavaScript” by Nicholas C. Zakas. I’ll post a review about it as well once I am done.