|
![](/i/fill.gif) |
> (Since the "namespace bid = boost::io::detail;" ought to be somewhere in
> the beginning of the file or the beginning of the function where it's
> used,
> it ought to be hard to miss, so it's easy for the reader to know what it
> means.)
Depends how many namespace typedefs you're using, it could easily become
awkward to remember or check every one in a file. Modern IDEs show the full
type definition just by hovering over the code (which you can use if you are
unsure about anything), so personally I have never found this an issue.
> 2) It greatly lessens the possibility of name collisions
Sure, agreed.
>> The disadvantages are obvious - having to type bid:: before every type
>> (annoying if almost every line contains several types from that
>> namespace)
>
> Do you also use single-character and two-character names for all your
> variables, functions and types so that you have less to type?
Not 1 or 2 characters, but I try to keep them relatively short (eg
frWheelLoc rather than frontRightWheelLocation), otherwise lines end up
being 80+ characters long rather than ~40, which makes a lot of difference
to readability IMO.
> Brevity only leads to obfuscation, ie. it causes the code to be harder
> to understand. Using unambiguous names and prefixes makes the code easier
> to read and understand.
I agree up to a point, but IME you can go too far the other way where almost
every statement is going over several lines, you end up having to split
would-be single statements into multiple ones, and thus functions take up
much more lines. Whilst it may read very nicely if you have the time,
personally I find it slower to visually find stuff when all the variable and
function names are too long.
>> and your code looks very "unoptimised" when the same string is repeated a
>> huge number of times.
>
> Unoptimised? I don't understand what you mean. Unoptimized in what way?
As in it looks like you could be writing it more efficiently. Same way as
when you see:
myList.Add( 5 );
myList.Add( 6 );
myList.Add( 7 );
myList.Add( 8 );
You think there must be a better way to do it (using a loop). If I see:
mfxg::CreateTexture( mfxg::Pixel( mfxg::Color(1,1,0.5) ) ,
mfxg::Style::None );
I think there must be a more efficient way to code that.
Post a reply to this message
|
![](/i/fill.gif) |