Hi,
could someone help me by telling, how to find total number oflines in the code. The detail is like, I have a project which contains a number of files. Each file has different number of lines as code. I want to know is there any easy way/shortcut/options for finding the total number of line for the whole project.
I also checked the .M51 (map) file, it is indicating the number of lines in sequence from 1 onward for each function, but its really hectic to count for each and then add. Similarly editor is also showing the lines along the code inthe file but again its laborious to count and then add.
Looking for clever response.
Regards Asad
I got the same question 'Why there is a need for numer of lines of code' while searching online before posting here. Thing is, I need to calculate the software quality based on some calculaitons as used in my company, thats why I am asking this question. What I did, I just open the .lst files for each of the code file and then see the last line number of each file, and add together. Is it right? But I really appreciate your reply, thanks for that!
No - code metrics that only looks at the number of source lines is even worse than a code metrics that somehow tries to analyze the contents of the files.
How would a twice as large program get a different "quality" just because it is twice as large and contains twice as many source lines?
Code quality and number of source lines have extremely low correlation. You can have a 100-line program with extremely poor code quality and a million-line program with extremely good code quality.
And if including amount of comments in the code - pasting all documentation into the code doesn't make a big difference on the code quality compared to having the same documentation in separate documents. All it does is make it a slightly bit easier to update the documentation when the code is changed - while at the same time stops the developer from using graphical tools for the documentation since it suddenly got limited to text-only.
If you really do want to compute any code metrics, you should at least look at some tools that just looks at the source code and tries to evaluate the complexity of the code. Average and max size of functions. Average amounts of statements / function. Average amount of conditions in conditional statements. Average amount of nesting. Average and max number of symbols/source line (obviously excluding white and comment lines) That kind of metrics can at least be said to somehow affect how fast a developer can read the code and pick up the relevant structure, and does tell a bit about the number of symbols the developer needs to keep in his head when trying to modify the code.
Number of source lines can't be used for code quality. And it can't be used as metric for salary. It would actually be better to define a standard compiler and standard compilation settings and instead use the size of the binary as metric. The size of the generated binary would at least change with code density.
"I need to calculate the software quality based on some calculaitons as used in my company"
If your company requires it then, surely, they must have established ways to do it??
But simply counting source lines gives absolutely no indication whatsoever of software quality!
At the very least, you need to separately count both "code" and "comment" lines.
But this is still an almost useless measure - since it counts only quantity and cannot tell anything about quality!