5. Unter Softwarequalität versteht man die Gesamtheit der
Merkmale und Merkmalswerte eines
Softwareprodukts, die sich auf dessen Eignung beziehen,
festgelegte oder vorausgesetzte Erfordernisse zu
erfüllen.
(Balzert)
Tuesday 5 November 13
20. var Calculator = function () {};
Calculator.prototype.add = function(a, b) {
if('number' !== typeof a ||'number' !== typeof b)
throw new Error('Can add only numbers');
return a+b;
}
Tuesday 5 November 13
21. #1 Missing 'use strict' statement.
var Calculator = function () {}; // Line 1, Pos 31
#2 Empty block.
var Calculator = function () {}; // Line 1, Pos 30
#3 Expected exactly one space between 'function' and '('.
Calculator.prototype.add = function(a, b) { // Line 3, Po
#4 Missing 'use strict' statement.
if('number' !== typeof a ||'number' !== typeof b) // Line
#5 Expected exactly one space between 'if' and '('.
if('number' !== typeof a ||'number' !== typeof b) // Line
#6 Missing space between '||' and 'number'.
if('number' !== typeof a ||'number' !== typeof b) // Line
#7 Expected exactly one space between ')' and 'throw'.
throw new Error('Can add only numbers'); // Line 6, Pos 9
#8 Expected '{' and instead saw 'throw'.
throw new Error('Can add only numbers'); // Line 6, Pos 9
#9 Stopping. (54% scanned).
// Line 6, Pos 9
Tuesday 5 November 13
24. return 42; // Return statement not inside a function
function f() {
'use strict';
// No more octal
var x = 042;
// Duplicate property
var y = { x: 1, x: 2 };
// With statement can't be used
with (z) {}
}
Tuesday 5 November 13
25. validate.js:1: Illegal return statement
validate.js:7: Octal literals are not allowed in
strict mode.
validate.js:10: Duplicate data property in object
literal not allowed in strict mode
validate.js:10: Strict mode code may not include a
with statement
Tuesday 5 November 13
33. pmd/example.js:3:!
Avoid assignments in operands
pmd/example.js:3:!
Avoid using global variables
pmd/example.js:3:!
Use ===/!== to compare with
true/false or Numbers
Tuesday 5 November 13