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 558957
To read all comments associated with this story, please click here.
Not sure I agree
by Neolander on Wed 17th Apr 2013 21:55 UTC
Neolander
Member since:
2010-03-08

When a programming language becomes very, very complex, like C++, what happens is that each person will use it in a different way, and no one will manage to fit the whole feature set in his mind. To follow his comparison to human languages, we end up with a dialect-like situation: people speak multiple variants of a single language, yet end up having a hard time to understand each other.

My conclusion is that languages should have a feature set that is large enough to provide good expressivity, but not so large as to cause the emergence of such code dialects. It's arguably a fragile balance, and may be a subjective one: if you ask me, the Go programming language is quite balanced on this front, but I've recently had quite a long argument with someone around here, moondevil I think, who argued that this language went way too far in the name of simplicity.

By the way, I'm not surprised to see the opinion that many features are best coming from someone who likes C++ and C#. Both languages have gone pretty far down the path of adding every feature under the sun for the sake of expressiveness and programmer freedom. In C#, there even is a language keyword, yield, which to the best of my knowledge only serves the purpose of implementing iterators in a slightly more elegant way.

Edited 2013-04-17 22:14 UTC

Reply Score: 6

RE: Not sure I agree
by Alfman on Wed 17th Apr 2013 22:12 in reply to "Not sure I agree"
Alfman Member since:
2011-01-28

Neolander,

I was going to say something similar. Code in either simple languages or complex languages can be difficult to read and understand for different reasons.

Consider the utterly simple computer language grammar used by the turing machine. Every step is so trivial that almost anyone should understand it, but so many steps are required that expressing any algorithm of significant complexity would make anybody's head explode. Too many steps are needed to solve the target problem. It's inefficient.

A balance is needed, but I don't think a universal one is possible as it depends on both the programmer as well as the task at hand.

Reply Parent Score: 2

RE[2]: Not sure I agree
by Kochise on Thu 18th Apr 2013 06:25 in reply to "RE: Not sure I agree"
Kochise Member since:
2006-03-03

Let's all return to the basis : Lisp, or even simpler, Scheme !

Powerful, abstract, expressive. Why so many languages popping around, why not just... Zoidberg ?

Kochise

Reply Parent Score: 3

RE: Not sure I agree
by ssokolow on Wed 17th Apr 2013 22:34 in reply to "Not sure I agree"
ssokolow Member since:
2010-01-21

In C#, there even is a language keyword, yield, which to the best of my knowledge only serves the purpose of implementing iterators in a slightly more elegant way.


Out of all the details you had to pick, you picked that one as pointless syntactic fluff?

Don't say that around Python programmers or users of various functional languages unless you want to get into a big argument.

Reply Parent Score: 3

RE[2]: Not sure I agree
by Neolander on Thu 18th Apr 2013 06:01 in reply to "RE: Not sure I agree"
Neolander Member since:
2010-03-08

Out of all the details you had to pick, you picked that one as pointless syntactic fluff?

Don't say that around Python programmers or users of various functional languages unless you want to get into a big argument.

Thanks, I'll keep that in mind ;) Been meaning to try functional programming for some time now, but never truly got around it at this point.

From afar, it always seems to be a mathematician-oriented way of coding, just like Labview's graphical dataflow programming feels like something designed by and for electronics engineers.

Edited 2013-04-18 06:02 UTC

Reply Parent Score: 2

RE: Not sure I agree
by moondevil on Thu 18th Apr 2013 06:19 in reply to "Not sure I agree"
moondevil Member since:
2005-07-08

I tend to prefer languages like C++, C#, Ada and so on, because I am the opinion the language should be expressive to explore multiple abstractions and powerful enough to allow user types to behave like built-in ones.

Maybe that works for me, given the years I have been coding (since '86) and my background in compiler design.

Reply Parent Score: 3

RE[2]: Not sure I agree
by TempleOS on Thu 18th Apr 2013 06:37 in reply to "RE: Not sure I agree"
TempleOS Member since:
2013-04-03

I tend to prefer languages like C++, C#, Ada and so on, because I am the opinion the language should be expressive to explore multiple abstractions and powerful enough to allow user types to behave like built-in ones.


When I was young, I got excited about making new operators. Now, I see that as foolish, except where operators in math are already defined. Matrix and complex math is good with operators, but kids will foolishly use them where there is no precident (no pun intended.)

I think you would be better off just making built-in matrix and complex types... but there are many ways to define matrices--sparse etc.

cout <<1<<3<<"What?"<<endl;

I'm not fond of that. What if I want shift operators on numbers? It's too damn verbose. I have something less flexible, but more practical.

printf("Name:%s Age:%d\n",name,age);

You can use this: There is only one stream.

"Name:%s Age:%d\n",name,age;

Edited 2013-04-18 06:38 UTC

Reply Parent Score: 1

RE: Not sure I agree
by Lennie on Thu 18th Apr 2013 22:14 in reply to "Not sure I agree"
Lennie Member since:
2007-09-22

C++ is a lot of the time is the wrong choice, if you ask me.

I'm more likely to use C.

I like what Pike had to say about the differences between C and Go:

http://commandcenter.blogspot.com/2012/06/less-is-exponentially-mor...

Reply Parent Score: 2