Friday, February 19, 2010

An Alternative to SLOC

Awhile ago I was sucked into development of a DoD proposal. One thing they wanted us to address was SLOC, or "Source Lines of Code". The idea is that they judge the level of software effort and complexity by the lines of code there are. There is a general consensus in the software world that this isn't the best idea. IE, if you write a function call like this

if (a==1)
_tprintf(_T("Status Report:\n")

Your SLOC will be much higher than if you wrote it like this.

if (a==1) _tprintf(_T("Status Report:\nHello!\n");

There are other arguments I agree on, such as smaller/simpler/efficient source code is better than bloated source code that achieves the same functionality.

I thought of an alternative on the drive in to work today that at least addresses the amount of new lines put in your coding standards. What if we looked noPublish Postt at the source code, but the size of the post-compiled binary machine code? In windows, this would be the size of all the EXEs and DLLs that comprise your application. Now granted, this would probably only be useful for uninterpreted languages (ie C/C++ and Assembly). You would also have to examine how much code is statically linked into your executable, so it doesn't get recounted. But at least your processess for assessment isn't based off of how often the development team hit the "enter" key.

No comments:

Post a Comment