Introduction

Writing JavaScript is more fun today than it's ever been before. In recent years, HTML5 introduced a wide variety of JavaScript APIs that push the boundaries of what developers can achieve in the browser. These new APIs allow you to create impressive features such as 3D graphics, geolocated data, and high performance animation. But HTML5's advancements are much more than flashy components to stun your audience. They also include a number of APIs to streamline the development process and allow you to create the next generation of web apps.

If the browser-level advancements aren't enough to get you excited, there's also server-side JavaScript with Node.js. Node isn't just some academic exercise about making a server with JavaScript. It's a production-ready server solution that caters to modern web app models, which need to relay messages to and from the user in real time.

This book teaches you how to create a next generation JavaScript app. You'll not only learn how to build the app, but I also explain the theory behind the way you should build it. By the end of the book, you'll be armed with techniques for building rich, interactive apps. But more importantly, you'll have a deeper understanding of engineering best practices. You'll be a more responsible developer whether you're writing JavaScript, or using another language to build the apps of the future.

The book is divided into four parts:

Part I: A Firm Foundation—Part I starts by covering some general best practices and drives home the book's central messages: loose coupling and the separation of concerns. It then discusses a number of development tools and teaches you how to establish a test driven development (TDD) approach using Grunt.js. Last, it compares a number of different libraries and frameworks you can use to jumpstart your development, and teaches you how to pick the best one for your individual project.

Part II: Building The Front-End—In Part II, you dive in to building a foundation for an app using Backbone.js, which lets you you set up an MVC for your front-end, separating the data from the interface. You also learn to establish an Ajax-based navigation system using pushState. Next, Part II extends what you learned about Backbone, teaching you how to render views using a JavaScript templating engine. Templates allow you to further separate your app's data from its presentational layer.

Finally, the section covers some best practices for form handling and validation to help you complete your app's foundation. You use a progressive enhancement approach, starting with a solid HTML5 base state, upon which you add JavaScript widgets, as well as polyfills to support older browsers. You then create a form in Backbone that automatically syncs with your app's backend.

Part III: Working with Serverside JavaScript—In Part III, you learn how to write JavaScript on the server using Node.js. You start by learning the basics of Node, including how it works and when to use it. You also discover some general patterns of Node development to inform how you work with the platform.

Next, I introduce you to the Express framework, which will streamline your Node development and allow you to hit the ground running. You learn how to set up routes, render views using templates, and handle form postdata. Finally, you learn about MongoDB, a NoSQL database you can use with Node as an alternative to conventional relational databases like MySQL.

Part IV: Pushing The Limits—In Part IV you push the limits of what your app can do. First, you learn how to build a real-time app, tying your server-side JavaScript knowledge together with the client-side techniques you learned in Part II. You discover WebSockets, and how to set them up in Node using Socket.IO. Then you walk through the creation of an example real-time app using Backbone.js, Express, and MongoDB.

Next I cover building your app's mobile components. You learn how to serve responsive content and use a mobile framework to arm your mobile development efforts. I also teach you how to set up handlers for touch gestures using Hammer.js, and take advantage of mobile-specific APIs such as geolocation. Then, you discover how PhoneGap can bridge the gaps in the browser-level APIs and create a dedicated mobile app based in JavaScript.

After going mobile, you discover one of the most exciting capabilities of HTML5: drawing graphics in the browser. You learn the basics of working with canvas and SVG, as well as how to use the Raphaël SVG library. Last but not least you learn how to render 3D graphics using WebGL and the Three.js library.

Finally, I provide a checklist of last-minute issues to handle for launch. You learn how to profile performance, as well as techniques for handling any performance issues that arise. You also discover best practices for how and where to deploy your app.

Companion Website

JavaScript Programming: Pushing the Limits has a companion website at http://www.wiley.com/go/ptl/javascriptprogramming. The site includes code samples and demos from the examples in the book, as well as links to further resources. It's a great place to start if you're having trouble understanding a section, or just want to copy and paste the code samples.

Start Pushing the Limits

JavaScript Programming: Pushing the Limits provides a roadmap for building modern web apps. It includes solutions for the common problems you'll face, as well as general best practices for handling anything else. The book is geared towards advanced frontend developers as well as experienced backend developers who are interested in Node and have a solid understanding of JavaScript. Developers with an intermediate understanding of JavaScript should also be able to follow the concepts and examples in the book (by the end of which their skills will be much more advanced). While you should thoroughly understand client-side JavaScript, you don't need any previous experience with server-side JavaScript to understand the Node sections, since Part III starts from the ground up.

So get ready to dive in and start building a next generation web app!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset