Image of Mastering JavaScript Design Patterns

Coming from a background of coding in C++, Java and Ruby, the object oriented programming took time to wrap my head around when coding in Javascript. I’ve had an opportunity to create a large application using AngularJS and several smaller applications over a couple of years. Each left new curiosities in the process - How can I create a better interface? How can I abstract certain areas of my code and expose only a few? How can I protect the object attributes better? On my journey to satisfy these curiosities, Mastering JavaScript Design Patterns has entered recently as a great teacher.

It starts with introducing the history of Javascript. Further, it leads into the basics of how code is organized in javascript while comparing with traditional OOPs concepts of classes, modules and inheritance. It also introduces ES6 early in the book and the new syntax sugar available in it that makes the code more readable.

It then descends into the design patterns grouped traditionally as GOF creational, structural, behavioral patterns. I’ve had several Aha! moments while reading these. The javascript duck typing and the absence of traditional classes and interfaces makes the implementations quite different from what you would see in a traditional OOP language like C++ and Java. The author makes a great effort in presenting it well and entertaining by introducing examples related to Game of Thrones. For those who have watched it, can relate to it, for those who haven’t, Spoilers Alert! No. Not really… :)

It further gets more interesting in further chapters on topics that apply to modern Javascript applications and play to the special powers of Javascript. The topics include functional programming and how the patterns used in the modern frameworks like Angular work. I haven’t read them all yet but took a sneak peek and am looking forward to be reading them.

Reading the book feels like attending a computer science lecture from a good professor. The author tries to make remarks in parentheses like “aren’t you glad I chose to use this example” or when he highlights his witty puns. The author makes references to other programming language and presents different angles to a problem and the philosophical side to it which makes it a great read and gives a lasting impression.

Highly recommended to all javascript developers to better their software craftsmanship.

https://www.packtpub.com/application-development/mastering-javascript-design-patterns