Linked by MOS6510 on Wed 17th Apr 2013 21:20 UTC
General Development "You often hear about how important it is to write 'readable code'. Developers have pretty strong opinions about what makes code more readable. The more senior the developer, the stronger the opinion. But, have you ever stopped to think about what really makes code readable?"
Thread beginning with comment 558964
To read all comments associated with this story, please click here.
Consistency
by flypig on Wed 17th Apr 2013 22:27 UTC
flypig
Member since:
2005-07-13

Really interesting article, and worth bearing in mind for anyone involved in teaching programming.

However, in terms of the wider argument, I think an important point the article misses is about consistency. One of the problems with natural languages like English is that the rules are not consistent (in the non-mathematical sense), which makes them very hard to learn. You can make a language easier to learn without reducing its expressiveness by making it more consistent.

It doesn't follow that consistency breads simplicity (as Alfman pointed out, the simple rules of a Turing machine don't make programming in it easier). On the other hand lack of consistency definitely results in complexity (like, for example INTERCAL!).

Reply Score: 5

RE: Consistency
by jessesmith on Thu 18th Apr 2013 12:06 in reply to "Consistency"
jessesmith Member since:
2010-03-11

I agree with the part about consistency. Even if another programmer has a very different style from my own it's usually easy to figure out what they are doing if their approach is consistent. I don't really care if another coder uses "iCoins" or "NumOfCoins" or "numberOfCoins" as long as their approach is the same in each block/function.

The code I find hardest to work on is when multiple programmers have hacked on it and each one uses a different style. The code tends to become a mess if consistency isn't maintained.

Reply Parent Score: 2

RE[2]: Consistency
by bosco_bearbank on Thu 18th Apr 2013 13:56 in reply to "RE: Consistency"
bosco_bearbank Member since:
2005-10-12

The code I find hardest to work on is when multiple programmers have hacked on it and each one uses a different style. The code tends to become a mess if consistency isn't maintained.

I have to slightly disagree.
1. The code I find hardest to work on is code I've personally written and hacked on over the years, each time using my then-current favorite style.
2. I can write consistently-styled spaghetti code.

Reply Parent Score: 2