in reply to Re^3: What is code readability?
in thread What is code readability?
Ug :) I really hate that. I see no benefit in spaces both sides of the commas, or breaking the open paren away from the function name. And if you have to break the params across lines, at least balance their lengths :)
some_function( some_variable, some_other_variable, and_yet_another_variable, and_one_more_for, luck );
That's not so bad for simple (void) calls as, but when you're retrieving data and checking you get something like
if( some_return_value = some_function( some_variable, some_other_variable, and_yet_another_variable, and_one_more_for, luck ) ) { // do some stuff here with some_return_value } else { // report or otherwise handle the error }
It's just a mess.The best I've come up with for this is
if( some_return_value = some_function( some_variable, some_other_variable, and_yet_another_variable, and_one_more_for, luck ) ) { // do some stuff here with some_return_value } else { // report or otherwise handle the error }
Which ain't great, but is better than most alternatives to my eyes.
And much better still is
if( someRv = fSome( some, oSome, AYAnother, OneMoreFor, luck )) { // do some stuff here with someRv } else { // report or otherwise handle the error }
With the point being that whilst ths abbreviated variable names don't immediately make much sense, by the time a programmer has got familiar enough with the code to consider making changes, they will.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: What is code readability?
by wfsp (Abbot) on Jan 14, 2007 at 09:43 UTC | |
by BrowserUk (Patriarch) on Jan 14, 2007 at 12:45 UTC | |
Re^5: What is code readability?
by Anonymous Monk on Sep 10, 2009 at 09:26 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2009 at 10:52 UTC |