Introduction

Introduction to JavaScript & Patterns.

A review of JavaScript in the context of Design Patterns and Pattern Architectures.



Essentials


The goal of JavaScript & Pattern Essentials section is to review JavaScript in the context of Design Pattern development and provide a solid foundation for building modern web apps using JavaScript design patterns and pattern architectures. This will create a level playing field for all app developers wanting to learn about JavaScript patterns. A variety of topics will be covered.

This package is about design patterns and best practices, so we will start off with a brief introduction on design patterns, their history, and the benefits of using them in modern day app development. We will also touch on the rather unique relationship that exists between JavaScript and design patterns.

Objects and their interactions play a central role in design patterns. JavaScript is an object-oriented language and it is important to have a good understanding of object modeling and object-oriented design. To this end we have a section on JavaScript OO Design which includes a review of the relevant SOLID and DRY principles. This section ends with another principle called the Rule of Three.

Web pages can easily get unwieldy in which JavaScript, HTML and CSS styling are all jumbled together. In the section on Unobtrusive JavaScript you will learn how to structure your pages using the principles of unobtrusive JavaScript and separation of concerns.

Next we take a deep dive into two areas that are important to JavaScript developers: 1) the event loop and 2) JavaScript prototypes. Both areas are a frequent source of confusion and it is essential that you thoroughly understand these topics to be able to write efficient and effective JavaScript applications.

Over the course of your career you are likely to run into JavaScript code that has you dumbfounded. Perhaps you understand it syntactically, but it does not seem to make any sense. JavaScript is a flexible language that allows shortcuts (i.e. idioms) that are powerful and elegant, but often incredibly hard to decipher. We have a section on cracking JavaScript idioms in which we highlight numerous idioms to help you understand these obscurities. This actually is a fun section; JavaScript allows you to do some pretty weird things.

In the final part of this section we list a set of common-sense coding standards and style guidelines. Having a clear standard will allow you and your team to build a body of code that is easy to read, easy to understand, and can be maintained by any other developer on the project.

Without further ado, let's get started with a review of Design Patterns.