Yesterday I've completed my first LOC counter.
LOC stands for "Lines Of Code" and the basic purpose is to count the number of valid lines of code that were written for a specific program.
First of all, in order to be able to count anything - you will need to specify a coding standard template.
This template is a small paper with all the rules regarding the way how code should be written for a given task. For example, avoid excessive capitalization, split each logical statement onto it's own line, assign meaningful titles to variables and so on and on.
My first attempt at designing a LOC was fairly simplistic. It simply stripped away the comments or empty lines be done with it.
But this wasn't a very realistic view of the true LOC.
As mentioned by the teacher, adding tags to the code would be more productive (even thought not mentioned in the task requirements) and so I did.
The results couldn't have been better.
I simply add "//TAG:X" (where X is replaced by the code of the category where the code belongs) and it will count all valid lines until the "//finished" tag is found.
Very simple but also very effective. This way I'm capable of truly counting the lines of quality code between what has been added, modified or recycled.
The PSP also requires to count deleted lines so I've made another tag "//DELETED,15", where 15 is the number of deleted lines.
This sort of software is really interesting, in the past I'd simply count all lines from top to bottom, most admit that this is a substantial improvement.
Unfortunately, all these modifications and all the troubles of moving away from the Azores made my fall behind schedule to deliver the assignments. I better start working to get back on track..