Maintainable JavaScript

Overview

You may have definite ideas about writing code when working alone, but team development requires that everyone use the same approach. With the JavaScript practices in this book—including code style, programming tips, and automation—you will learn how to write maintainable code that other team members can easily understand, adapt, and extend.

Author Nicholas Zakas assembled this collection of best practices as a front-end tech leader at Yahoo!, after completing his own journey ...

See more details below
Paperback
$26.61
BN.com price
(Save 33%)$39.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (16) from $12.60   
  • New (10) from $20.68   
  • Used (6) from $12.60   
Maintainable JavaScript

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$18.99
BN.com price
(Save 44%)$33.99 List Price

Overview

You may have definite ideas about writing code when working alone, but team development requires that everyone use the same approach. With the JavaScript practices in this book—including code style, programming tips, and automation—you will learn how to write maintainable code that other team members can easily understand, adapt, and extend.

Author Nicholas Zakas assembled this collection of best practices as a front-end tech leader at Yahoo!, after completing his own journey from solo hacker to team player. He also includes rules recommended by other industry authorities. Use these tips and techniques to help your team set aside individual preferences and function at a higher level.

  • Establish specific code conventions for your team
  • Use tools such as JSLint and JSHint to keep your team on track
  • Adopt style guidelines, such as basic formatting, to help your team produce uniform code
  • Apply several programming practices to solve problems and improve code quality
  • Create an automated JavaScript build system using a variety of utilities
  • Integrate browser-based JavaScript testing with tools such as the YUI Test Selenium Driver
Read More Show Less

Product Details

  • ISBN-13: 9781449327682
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 5/31/2012
  • Edition number: 1
  • Pages: 242
  • Sales rank: 780,334
  • Product dimensions: 6.90 (w) x 9.10 (h) x 0.70 (d)

Meet the Author

Nicholas C. Zakas is a front-end consultant, author, and speaker. He worked at Yahoo! for almost five years, where he was front-end tech lead for the Yahoo! homepage and a contributor to the YUI library. He is the author of Professional JavaScript for Web Developers (Wrox, 2012), Professional Ajax (Wrox, 2007), and High Performance JavaScript(O’Reilly, 2010). Nicholas is a strong advocate for development best practices including progressive enhancement, accessibility, performance, scalability, and maintainability. He blogs regularly at http://www.nczonline.net/ and can be found on Twitter via @slicknet.

Read More Show Less

Table of Contents

Introduction;
Preface;
Conventions Used in This Book;
Using Code Examples;
Safari® Books Online;
How to Contact Us;
Style Guidelines;
Chapter 1: Basic Formatting;
1.1 Indentation Levels;
1.2 Statement Termination;
1.3 Line Length;
1.4 Line Breaking;
1.5 Blank Lines;
1.6 Naming;
1.7 Literal Values;
Chapter 2: Comments;
2.1 Single-Line Comments;
2.2 Multiline Comments;
2.3 Using Comments;
2.4 Documentation Comments;
Chapter 3: Statements and Expressions;
3.1 Brace Alignment;
3.2 Block Statement Spacing;
3.3 The switch Statement;
3.4 The with Statement;
3.5 The for Loop;
3.6 The for-in Loop;
Chapter 4: Variables, Functions, and Operators;
4.1 Variable Declarations;
4.2 Function Declarations;
4.3 Function Call Spacing;
4.4 Immediate Function Invocation;
4.5 Equality;
4.6 eval();
4.7 Primitive Wrapper Types;
Programming Practices;
Chapter 5: Loose Coupling of UI Layers;
5.1 What Is Loose Coupling?;
5.2 Keep JavaScript Out of CSS;
5.3 Keep CSS Out of JavaScript;
5.4 Keep JavaScript Out of HTML;
5.5 Keep HTML Out of JavaScript;
Chapter 6: Avoid Globals;
6.1 The Problems with Globals;
6.2 Accidental Globals;
6.3 The One-Global Approach;
6.4 The Zero-Global Approach;
Chapter 7: Event Handling;
7.1 Classic Usage;
7.2 Rule #1: Separate Application Logic;
7.3 Rule #2: Don’t Pass the Event Object Around;
Chapter 8: Avoid Null Comparisons;
8.1 Detecting Primitive Values;
8.2 Detecting Reference Values;
8.3 Detecting Properties;
Chapter 9: Separate Configuration Data from Code;
9.1 What Is Configuration Data?;
9.2 Externalizing Configuration Data;
9.3 Storing Configuration Data;
Chapter 10: Throw Your Own Errors;
10.1 The Nature of Errors;
10.2 Throwing Errors in JavaScript;
10.3 Advantages of Throwing Errors;
10.4 When to Throw Errors;
10.5 The try-catch Statement;
10.6 Error Types;
Chapter 11: Don’t Modify Objects You Don’t Own;
11.1 What Do You Own?;
11.2 The Rules;
11.3 Better Approaches;
11.4 A Note on Polyfills;
11.5 Preventing Modification;
Chapter 12: Browser Detection;
12.1 User-Agent Detection;
12.2 Feature Detection;
12.3 Avoid Feature Inference;
12.4 Avoid Browser Inference;
12.5 What Should You Use?;
Automation;
Chapter 13: File and Directory Structure;
13.1 Best Practices;
13.2 Basic Layout;
Chapter 14: Ant;
14.1 Installation;
14.2 The Build File;
14.3 Running the Build;
14.4 Target Dependencies;
14.5 Properties;
14.6 Buildr;
Chapter 15: Validation;
15.1 Finding Files;
15.2 The Task;
15.3 Improving the Target;
15.4 Other Improvements;
15.5 Buildr Task;
Chapter 16: Concatenation and Baking;
16.1 The Task;
16.2 Line Endings;
16.3 Headers and Footers;
16.4 Baking Files;
Chapter 17: Minification and Compression;
17.1 Minification;
17.2 Compression;
Chapter 18: Documentation;
18.1 JSDoc Toolkit;
18.2 YUI Doc;
Chapter 19: Automated Testing;
19.1 YUI Test Selenium Driver;
19.2 Yeti;
19.3 PhantomJS;
19.4 JsTestDriver;
Chapter 20: Putting It Together;
20.1 Missing Pieces;
20.2 Planning the Build;
20.3 Using a CI System;
JavaScript Style Guide;
Indentation;
Line Length;
Primitive Literals;
Operator Spacing;
Parentheses Spacing;
Object Literals;
Comments;
Variable Declarations;
Function Declarations;
Naming;
Strict Mode;
Assignments;
Equality Operators;
Ternary Operator;
Statements;
White Space;
Things to Avoid;
JavaScript Tools;
Build Tools;
Documentation Generators;
Linting Tools;
Minification Tools;
Testing Tools;
Colophon;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)