Object Oriented JavaScript Review

January 19, 2015



Introduction

This is the review of the book "Object-Oriented JavaScript", written by the author Stoyan Stefanov who is a Facebook engineer and speaker, he has many notable works including the site JSPatterns.com which talks deeply about achieving best JavaScript design pattern. The book is aimed towards users looking to get started with JavaScript; the author takes into consideration that user might be new as it touches from the basics to advanced topics. The following section contains a breakdown of each chapters.

Object Oriented Javascript

Chapter 1 (Object Oriented JavaScript)

This chapter deals with the evolution of JavaScript, it touches a lot from the history of JavaScript till modern adaptation, it also goes further to explain Object Oriented Programming in relative to JavaScript, the user will be introduced to various utilities , used for debugging JavaScript code on various platform and client browsers such as jsc(JavaScriptCore), NodeJS and the Webkit inspector found in the Chrome and Safari browsers.

Chapter 2 (Primitive Data Types, Arrays, Loops, and Conditions) 

This chapter introduces the primitive data types and objects in JavaScript such as Numbers, Strings and Array, it covers writing codes using conditions, loops and also commenting your JavaScript source files, it further explains some common issues during comparison an example being the strict type checking.

Chapter 3 (Functions)

This introduces the users to creating of functions and various ways of declaring functions in JavaScript, This chapter is one of the most important chapter as it highly covers the core theme around JavaScript, it shows various forms of functions such as self-invoking functions, named functions, anonymous functions, callbacks, predefined functions and also variable hoisting. The most anticipated topic in JavaScript "Closure", is carefully explained; it elaborates on how Closures works and some slight issues to experience while working with closures, this chapter is simply one you will find yourself constantly consulting.

Chapter 4 (Objects)

Chapter 4 covers Objects in JavaScript; it explains various ways Objects can be created using the literal notation or using constructor functions. It also deeply explains the Global Object and other built in objects such as Math, Date, RegEx and numerous other objects. A great part of this article is that it sheds light on Error objects as well and how to interpret them.

Chapter 5(Prototype)

Another chapter that touches a core topic in JavaScript, the chapter discusses how methods can be added to an object through the prototype, also how to determine if an object has its own property as compared to inheriting from the prototype chain. It also sheds light on common issues with prototypes and also explains what is commonly known as "shims", "monkey patching" in the JavaScript world.

Chapter 6 (Inheritance)

This chapter is a bit technical, it shows numerous ways inheritance can be achieved in JavaScript, it employs many methods to illustrate how object properties can be copied to simulate classes, however it is quite important to note that this chapter will require more than just reading but also coding. Another great aspect of this chapter is that it explains the numerous option used for extending classes by using a case study to deliver the point.

Chapter 7 (Browser Environment)

Chapter 7 shifts away from ECMAScript and focuses on the BOM (Browser Object Model) and DOM (Document Object Model), it greatly covers a lot from document, nodes, events, propagation in events, types of events and also the XmlHttpRequest properly known as AJAX.

Chapter 8 (Coding and Design Patterns)

This chapter takes all the knowledge from previous chapters into consideration, it shows how you can adopt several design and coding patterns to build a complex JavaScript application with good practices. This chapter introduces the user to several popular design patterns such as the Singleton, Factory and the popular Observer pattern. This advantages of this chapter is that it explains the modern pattern used in popular framework such example noticed is the chaining pattern adopted in the jQuery library.

Summary

Stoyan Stefanov really went all out by breaking down and touching every important part in JavaScript in 382 pages, currently there are tons of JavaScript frameworks such as the Dojo Toolkit, jQuery, Backbone and the numerous list of others. Users often jump into these frameworks without having proper knowledge of JavaScript and this often leads to user getting frustrated with such frameworks or written poor codes. This books caters to developers new to JavaScript as it introduces everything related to JavaScript, it also caters to experienced JavaScript developers as it touches issues, and design patterns. There were several topics which i found interesting that were mentioned, were Closures, Error Objects and introducing users to the past and future of JavaScript and it's possible future, this point were important as it gave me a sense of why i would to invest my time using JavaScript.

About the Author

Stoyan Stefanov is a Facebook engineer, author, and speaker. He talks regularly about web development topics at conferences and his blog www.phpied.com, and also runs a number of other sites, including JSPatterns.com?a site dedicated to exploring JavaScript patterns. Previously at Yahoo!, Stoyan was the architect of YSlow 2.0 and creator of the image optimization tool Smush.it. A "citizen of the world", Stoyan was born and raised in Bulgaria, but is also a Canadian citizen, currently residing in Los Angeles, California. In his offline moments, he enjoys playing the guitar, taking flying lessons, and spending time at the Santa Monica beaches with his family.


Post Comment