The thing about code metrics

The unexamined code is not worth releasing – Socrates (probably)

I wrote plato because socrates was too long a name for a command line tool. I also wrote plato because I love metrics. I love stupid little numbers that mean arbitrary things and I love watching some of them go up and I love watching some of them go down.

Most of them are meaningless.

Or maybe they’re super meaningful.

Does it matter?

What really matters is questioning your work. Why do these numbers come up? Why do some numbers go down when you do foo and why do some go up when bar? Do you like your code more when the number is higher, or lower?

I see a lot of comments regarding the relative value of plato’s metrics, as if I thought of them, and that’s great but missing the point. The truth is, even if I did pull these metrics out of the air, if they are consistently generated based off open criteria then they are still useful as long as you find them to be meaningful. You can have opinions as to what is considered an operand vs an operator and what those mean to other calculations, but the relative validity of an individual metric in this scenario is irrelevant. The value is the baseline you come to and maintaining alignment with what you find important.

One of the common points of contention is the “Estimated Number of Bugs” which is a metric I love in part because it looks so intuitive to the untrained eye (read: management). It doesn’t mean that your silly little dropdown might not work in IE8 if the user logs on with a spotty 3g connection while riding a donkey in singapore. It means that, given the complexity of the work that has been provided, there is a potential likelihood of X errors in the implementation. You may have 0 actual bugs, you may have 1000. Don’t get hung up on it, just think about it a minute.

At the end of the day, the best code is what powers the tools that people use daily and find valuable in their lives. Some of the most useful tools have code that would knock a wildebeast dead (vi anyone?) but that’s not what history remembers.

Release quickly. Refactor always.

Leave a Reply