How to Know When Code Is Complex Using the McCabe Complexity Metric

How to Know When Code Is Complex Using the McCabe Complexity Metric

http://ift.tt/2qQSw5w

“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.

java

via DZone.com Feed https://dzone.com

May 23, 2017 at 07:39AM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s