문제

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!

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top