POV-Ray : Newsgroups : povray.off-topic : Hungarian notation : Re: Hungarian notation Server Time
4 Sep 2024 07:18:06 EDT (-0400)
  Re: Hungarian notation  
From: Warp
Date: 7 Jun 2010 13:42:54
Message: <4c0d2f9e@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >  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:

  Of course it doesn't help that the indentation sucks.

> 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;

  Well, I find the first example easier to read (after proper indentation)
because I see much faster with a quick scan which names are from the
standard C++ library and which are local variables or reserved keywords.

> 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.

  You might as well argue that all the ';' symbols are "noise in the code"
which add nothing and make it more difficult to read and write (after all,
the example would be completely unambiguous and parseable without them).

  Of course to others the ';' symbols actually make the code easier to
read because they are a visual clue to quickly see where a statement ends
and the next begins.

> 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.

  I have never, and will never understand some people's infatuation with
brevity.

  In programming brevity is not a virtue. If you want brevity, check the
IOCCC.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.