How Readable Is Your Code? Part 2

Once Again About Cyclomatic Complexity

In the first part, I've introduced Cyclomatic Complexity (CYC) metrics in the previous part. So CYC has no intention to be a readability code metric. CYC was invented a long time ago (in 1976)  by Thomas J. McCabe. 

Cognitive Complexity Metric.

Cognitive Complexity (CC) attempts to count the cognitive effort required to understand the code's flow. Let's take a look at the next example:

Should You Write Comments?

To comment or not to comment, that is the question. I had a little argument with some of my family members (who have also done some coding, although one of them is still in secondary school) about this subject. They had a quick look at some code I was writing at home and asked where my comments were. They were shocked at my reply when I told them I don't use them. So I'm going to write about some of the things I told them. When is it the right time to write them into your code, how helpful are they and what should they contain? These are the questions I want to answer.

I don't normally write comments into my code anymore, especially with the code I write at work. One of the first things I was told when I started working was to not write comments and, at first, I was a bit skeptical, but after a while, it made sense.