Question

I'm reading xUnit Test Patterns by Gerard Meszaros.

On one of the pages he refers to some software metrics:

While the need to wrap lines to keep them at 65 characters makes this code look even longer than it really is, it is still unnecessarily long. It contains 25 executable statements including initialized declarations, 6 lines of control statements, 4 in-line comments, and 2 lines to declare the test method—giving a total of 37 lines of unwrapped source code.

Short of counting the statements to find these metrics, does anybody have any idea if he used a particular tool to calculate the metrics?

(If you have any suggestions for tools that will count similar metrics, I'm looking for one that works on Java, Javascript and C++)

Thanks!

Was it helpful?

Solution

Sorry to disappoint you but I did count by hand (well, by eye). It's only 25 lines of code! I just went through and counted semi-colons and subtracted lines that weren't acutally executed (like uninitialized variable declarations.)

The point is not exactly how many lines of code there are but rather how much fewer lines of code you need to write (once) and read/understand/modify (many times).

Gerard

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top