How to Know When Code Is Complex Using the McCabe Complexity Metric
“Any darn fool can make something complex; it takes a genius to make something simple.” This quote has been attributed to different people, from Albert Einstein to Pete Seeger. Whatever the origin, I think it really applies to code. When given a task to accomplish, developers should all be able to code something that will work. But how will it be understood and maintained in the future? How can you objectively measure something as complex as… complexity?
For the size of a program, there is the standard Lines of Code. There are also metrics like the Halstead Metrics that help you in comparing programs on a high level, but they really don’t get to the inside the program. In other words, you can’t see that one part of the program is more complex than another. For that, we have to go down a level into the program.
via DZone.com Feed https://dzone.com
May 23, 2017 at 07:39AM