|
![](/i/fill.gif) |
> Something is "visual noise" when it makes the code *harder* to read
> because the "noise" is interfering with your capability of easily
> understanding the code.
I find this (to steal the example from the other group):
std::vector< std::string > v1 = someFunction();
std::vector< std::string > v2;
std::transform( v1.begin(), v1.end, v2.begin(), std::bind1st(
std::not_equal_to<
std::string >( "" ) ) );
for( std::vector< std::string >::iterator i = v2.begin(); i != v2.end();
++i )
std::cout << *i << std::endl;
much harder to read than this:
vector< string > v1 = someFunction();
vector< string > v2;
transform( v1.begin(), v1.end, v2.begin(), bind1st( not_equal_to<string >(
"" ) ) );
for( vector< string >::iterator i = v2.begin(); i != v2.end(); ++i )
cout << *i << endl;
And IMO I definitely count all those repeated "std::" as noise in the code
that does very little to enhance my understanding but severely slows down
the speed I can read and type it.
Sure if you want very formal code with no chance of ambiguity the 1st is
better, but the longer lines and extra typing put me off.
Post a reply to this message
|
![](/i/fill.gif) |