The document discusses best practices for developing high quality JavaScript applications. It recommends leveraging build tools like Grunt and integrating tools for linting, testing, minification and concatenation. Continuous integration with Jenkins is also suggested, as well as using IDEs and editors that support JavaScript. Architectural patterns like modules and design principles are important.
8. BONE AND BANE OF JS
$.ajax({
url: "person/2",
dataType: "json",
success: function (obj) {
var person = new Person();
$.extend(person, obj);
global.person.push(person);
}
});
9. BONE AND BANE OF JS
$.ajax({
url: "person/42",
dataType: "json",
success: function (obj) {
$.extend(Person.prototype, obj);
}
});
10. BONE AND BANE OF JS
$.ajax({
url: "person/2",
dataType: "json",
success: function (obj) {
var person = new Person();
if (someCondition(obj)) {
$.extend(person, {
getFullname: function () {
return first + " " + last;
}
});
}
global.person.push(person);
}
});
14. DEVELOPMENT CYCLE
static code analysis
development
productionalizing
concatenate
minimize
testing
unit test
component tests
JavaScript
findbugs, checkstyle
IDE
compile
testing
jUnit
selenium
Java
21. JSHINT - NOT A COMPILER
app/scripts/domain-factory.js
!
line 4 col 3 Missing "use strict" statement.
line 11 col 47 'suffix' is defined but never used.
line 16 col 22 Missing semicolon.
line 35 col 5 'person' is not defined.
line 37 col 11 Expected '===' and instead saw '=='.
line 38 col 5 Expected '{' and instead saw 'c'.
line 38 col 5 Expected 'c' to have an indentation at 7 instead at 5.
line 43 col 24 Missing 'new' prefix when invoking a constructor.