Presentation from phpday 2011 about software metrics and tools in php
Abstract:
Esiste un modo per decidere se una porzione di codice è migliore di un altra? Le metriche del codice forniscono misure oggettive sulla qualità del codice stesso. Nel talk verranno introdotte le principali metriche, gli strumenti che permettono di ricavarle e il loro utilizzo nel flusso di sviluppo.
10. Lines and Numbers
Lines
LOC: Lines Of Code
#phpday ELOC: Executable LOC
CLOC: Comment LOC
NCLOC: Non-Comment LOC
Numbers
NOC: Number Of Classes
NOM: Number Of Methods
NOP: Number Of Packages
11. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
5 abstract class shape {
6 /* Returns the area of the shape */
#phpday 7 abstract function area();
8 }
9
10 class circle extends shape {
11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
16
17 class triangle extends shape {
18
19 public function area() {}
20 }
21
22 ?>
12. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday 7 abstract function area();
8 }
9
10 class circle extends shape {
11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
16
17 class triangle extends shape {
18
19 public function area() {}
20 }
21
22 ?>
13. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday CLOC 2 7 abstract function area();
8 }
9
10 class circle extends shape {
11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
16
17 class triangle extends shape {
18
19 public function area() {}
20 }
21
22 ?>
14. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday CLOC 2 7 abstract function area();
8 }
NCLOC 20 9
10 class circle extends shape {
11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
16
17 class triangle extends shape {
18
19 public function area() {}
20 }
21
22 ?>
15. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday CLOC 2 7 abstract function area();
8 }
NCLOC 20 9
10 class circle extends shape {
ELOC 3 11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
16
17 class triangle extends shape {
18
19 public function area() {}
20 }
21
22 ?>
16. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday CLOC 2 7 abstract function area();
8 }
NCLOC 20 9
10 class circle extends shape {
ELOC 3 11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
NOP 1 16
17 class triangle extends shape {
18
19 public function area() {}
20 }
21
22 ?>
17. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday CLOC 2 7 abstract function area();
8 }
NCLOC 20 9
10 class circle extends shape {
ELOC 3 11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
NOP 1 16
17 class triangle extends shape {
NOC 3 18
19 public function area() {}
20 }
21
22 ?>
18. Lines and Numbers
1 <?php
2
Lines 3 namespace shapestwodimensional;
4
LOC 22 5 abstract class shape {
6 /* Returns the area of the shape */
#phpday CLOC 2 7 abstract function area();
8 }
NCLOC 20 9
10 class circle extends shape {
ELOC 3 11 public function area() {}
12
13 /* Ret the diameter of the circle */
Numbers 14 public function diameter() {}
15 }
NOP 1 16
17 class triangle extends shape {
NOC 3 18
19 public function area() {}
NOM 4 20 }
21
22 ?>