Download e-book for iPad: Maintainable JavaScript by Nicholas C. Zakas

By Nicholas C. Zakas

ISBN-10: 1449327680

ISBN-13: 9781449327682

You will have certain principles approximately writing code while operating on my own, yet group improvement calls for that everybody use an analogous process. With the JavaScript practices during this book—including code variety, programming counsel, and automation—you’ll the way to write maintainable code that different staff contributors can simply comprehend, adapt, and extend.

Author Nicholas Zakas assembled this selection of most sensible practices as a front-end tech chief at Yahoo!, after finishing his personal trip from solo hacker to crew participant. He additionally comprises principles suggested through different specialists. Use the following pointers and strategies to assist your crew put aside person personal tastes and serve as at the next level.

* identify particular code conventions in your crew
* Use instruments corresponding to JSLint and JSHint to maintain your group on the right track
* undertake sort instructions, resembling simple formatting, to assist your staff produce uniform code
* observe numerous programming practices to unravel difficulties and enhance code caliber
* Create an automatic JavaScript construct approach utilizing a number of utilities
* combine browser-based JavaScript trying out with instruments akin to the YUI try out Selenium driving force

Show description

Read or Download Maintainable JavaScript PDF

Similar javascript books

Get Professional JavaScript for Web Developers (3rd Edition) PDF

An important replace to a bestselling JavaScript book
As the most important scripting language for the net, JavaScript is supported through each smooth internet browser and permits builders to create client-side scripts that benefit from beneficial properties similar to animating the canvas tag and permitting client-side garage and alertness caches. After an in-depth advent to the JavaScript language, this up-to-date version of a bestseller progresses to collapse how JavaScript is utilized for net improvement utilizing the most recent internet improvement applied sciences. Veteran writer and JavaScript guru Nicholas Zakas exhibits how JavaScript works with the hot HTML5 in addition to different major advances in net improvement because it pertains to JavaScript.

* starts with an advent to JavaScript fundamentals after which strikes directly to extra complex issues relating to JavaScript and advances in internet improvement technologies

* Describes how JavaScript is applied into HTML5

* Covers browser/feature detection in scripts, event-driven JavaScript improvement, mistakes reporting and debugging, offline software and knowledge garage, and more

Professional JavaScript for internet builders, third variation is an authoritative JavaScript source that each net builders must have.

New PDF release: XML and Perl

While you're a Perl programmer seeking to discover Perl's XML services or an XML developer with a simple knowing of Perl, this ebook gives you all of the instruments required for XML processing with Perl. XML and Perl teaches you to create transportable, strong, and extensible purposes if you happen to use XML and Perl jointly.

New PDF release: Programming the BeagleBone Black: Getting Started with

Application your individual BeagleBone Black initiatives! construct artistic BeagleBone Black devices--no past programming or electronics adventure required. In Programming the BeagleBone Black, electronics guru Simon Monk explains crucial software improvement equipment via undemanding instructions and funky downloadable examples.

Get AngularJS Directives Cookbook PDF

Expand the features of AngularJS and construct dynamic internet purposes via growing custom-made directives with this feature of greater than 30 recipesAbout This BookLearn find out how to expand HTML templates in new how one can construct even higher internet functions with unheard of interface componentsBuild reusable directives for large-scale AngularJS applicationsCreate even refined and ambitious glossy internet apps with easeWho This booklet Is ForThis publication is for builders with AngularJS event who are looking to expand their wisdom to create or customise directives in any kind of AngularJS software.

Extra info for Maintainable JavaScript

Example text

My recommendation is to allow fall-throughs as long as a comment is used to indicate that the fallthrough is intentional. default Another point of contention with regard to switch is whether a default case is required. Some believe that a default should always be included even if the default action is to do nothing, as in: switch(condition) { case "first": // code break; case "second": // code break; } default: // do nothing You’re likely to find open source JavaScript code following this pattern, including default and just leaving a comment that nothing should happen there.

Here are some examples: // Good if (condition) { // if you made it here, then all security checks passed allowed(); } // Bad: No empty line preceding comment if (condition) { // if you made it here, then all security checks passed allowed(); } // Bad: Wrong indentation if (condition) { // if you made it here, then all security checks passed allowed(); } // Good var result = something + somethingElse; // somethingElse will never be null // Bad: Not enough space between code and comment var result = something + somethingElse;// somethingElse will never be null // Good // if (condition) { // doSomething(); // thenDoSomethingElse(); // } // // // // // // if } Bad: This should be a multiline comment This next piece of code is quite difficult, so let me explain.

Constructors JavaScript constructors are simply functions that are used to create objects via the new operator. The language contains many built-in constructors, such as Object and RegExp, and developers can add their own constructors to create new types. As with Naming | 13 other naming conventions, constructors follow the native language, so constructors are formatted using Pascal case. Pascal case is the same as camel case except that the initial letter is uppercase. So instead of anotherName, you would use AnotherName.

Download PDF sample

Maintainable JavaScript by Nicholas C. Zakas


by Kenneth
4.3

Rated 4.05 of 5 – based on 48 votes