POV-Ray : Newsgroups : povray.off-topic : code readability Server Time
7 Sep 2024 23:24:23 EDT (-0400)
  code readability (Message 14 to 23 of 73)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Orchid XP v8
Subject: Re: code readability
Date: 26 Jun 2008 16:09:33
Message: <4863f77d$1@news.povray.org>
Halbert wrote:
> I, for one, find it much easier to read C++ code which is braced like this:
> Why doesn't the rest of the world understand that?

No idea.

Annoying, isn't it??



The other thing that annoys me is Java's insistance on using camal case 
but with a lowercase first letter.

   lower_case_with_underscores is just fine.

   CamalCaseWithoutUnderscores is also fine.

   thisIsJustUnspeakablyHorrid!!

   EIFFEL_IS_WORSE_IN_THIS_REGARD...

Annoyingly, Haskell copies Java's incorrect use of camal case...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Halbert
Subject: Re: code readability
Date: 26 Jun 2008 16:21:37
Message: <4863fa51@news.povray.org>
How about Microsoft's engineers starting the whole Hungarian Notation 
convention with Windows programing. (like lpstrFilePath or iRecursion, etc.) 
There seems to be no set standard to it. While the intention is good,  a 
beginner may have wonder why some variables have names like lpszDemung or 
lpfnCBack.

--


Post a reply to this message

From: stbenge
Subject: Re: code readability
Date: 26 Jun 2008 16:52:16
Message: <48640180@news.povray.org>
Mike Raiford wrote:
> The only thing I'll say is that if there are coding standards in place, 
> follow the standard your organization uses.

If I worked for an organization, I would definitely change my style. Of 
course if I were programming for a living, I would probably go to school 
where they would teach me how to write code that people could decipher :)

Sam


Post a reply to this message

From: Orchid XP v8
Subject: Re: code readability
Date: 26 Jun 2008 16:56:38
Message: <48640286$1@news.povray.org>
stbenge wrote:

> Of 
> course if I were programming for a living, I would probably go to school 
> where they would teach me how to write code that people could decipher :)

Don't count on it! ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Darren New
Subject: Re: code readability
Date: 26 Jun 2008 17:20:37
Message: <48640825$1@news.povray.org>
Halbert wrote:
> How about Microsoft's engineers starting the whole Hungarian Notation 
> convention with Windows programing. 

Actually, this makes a lot of sense for C *when done right*.

The point was not to repeat in the variable name the types that you 
declared to the compiler. The point was to repeat in the variable name 
the types you CANNOT declare to the compiler.

If you have
   int line_width;
   int line_height;
   int page_height;
   int line_count;
   int pixel_count
the expressions
   page_height = line_count * line_height
and
   page_height = line_count * line_width
and
   pixel_count = page_height * line_width
and
   pixel_count = page_height * page_height
are equally type-correct as far as C is concerned, but two are nonsense.

So you declare
   int wLineWidth;
   int hLineHeight;
   int hPageHeight;
   int hwPixelCount;
   int lineCount;

Then you can write
   hPageHeight = hLineHeight * lineCount;
   hPageHeight = wLineWidth * lineCount; // Obvious nonsense!
   hwPixelCount = hLineHeight * wLineWidth; // Looks good
   hwPixelCount = hLineHeight * hPageHeight; // Nonsense!

Even picking nonsense variable names other than the notation will tell 
you that it's nonsense. If you see
   hSize = count * hQuantity; // Probably OK
   wSize = hQuantity * count; // Probably bogus

That was the idea of "Hungarian notation". Not that you should replicate 
what the compiler already knows, but distinguish types that the compiler 
can't, because you're using a language whose compiler was designed to 
fit into a PDP-11's memory.

-- 
Darren New / San Diego, CA, USA (PST)
  Helpful housekeeping hints:
   Check your feather pillows for holes
    before putting them in the washing machine.


Post a reply to this message

From: Sabrina Kilian
Subject: Re: code readability
Date: 26 Jun 2008 17:53:59
Message: <48640ff7$1@news.povray.org>
Halbert wrote:
> How about Microsoft's engineers starting the whole Hungarian Notation 
> convention with Windows programing. (like lpstrFilePath or iRecursion, etc.) 
> There seems to be no set standard to it. While the intention is good,  a 
> beginner may have wonder why some variables have names like lpszDemung or 
> lpfnCBack.
> 
> --

> 
> 

I do camel case with lowercase leading letters in my code. It's just how 
I name functions. Classes, objects, templates, etc get a leading capital 
letter, so do most instances of objects in C++.

Last group project class I was in, one teammate complained about it. He 
liked code written his way only, and since I was the debugger of the 
group he really didn't like my edits. He told me I could use any other 
convention I liked, but I was not to state with a leading lowercase 
without a reason. I offered to start with lowercase letters for 
Hungarian Notation. Very quickly, my normal method of naming was allowed 
to remain untouched.

It was sad that I had to explain why I was laughing and he was panicking 
to the third member of our group.


Post a reply to this message

From: Eero Ahonen
Subject: Re: code readability
Date: 26 Jun 2008 18:25:01
Message: <4864173d@news.povray.org>
Warp wrote:
> 
>   I disagree.
> 

Good, 'cause you're wrong.

-- 
Eero "Aero" Ahonen
    http://www.zbxt.net
       aer### [at] removethiszbxtnetinvalid


Post a reply to this message

From: stbenge
Subject: Re: code readability
Date: 26 Jun 2008 18:26:45
Message: <486417a5@news.povray.org>
Orchid XP v8 wrote:
> stbenge wrote:
> 
>> Of course if I were programming for a living, I would probably go to 
>> school where they would teach me how to write code that people could 
>> decipher :)
> 
> Don't count on it! ;-)

I should take *some* C++ courses, considering my near-total confusion 
when trying to use Irrlicht recently... I'm pretty much clueless when it 
comes to classes and such.


Post a reply to this message

From: Stephen
Subject: Re: code readability
Date: 26 Jun 2008 19:54:46
Message: <m1b86415b67sqdojgmt2b46f0uu930up14@4ax.com>
On Fri, 27 Jun 2008 01:26:58 +0300, Eero Ahonen
<aer### [at] removethiszbxtnetinvalid> wrote:

>Warp wrote:
>> 
>>   I disagree.
>> 
>
>Good, 'cause you're wrong.

I can't help but agree with you.
-- 

Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: code readability
Date: 26 Jun 2008 19:58:51
Message: <39b864d8vq6a336ve630j2rkpgovcpfm33@4ax.com>
On Thu, 26 Jun 2008 21:56:40 +0100, Orchid XP v8 <voi### [at] devnull>
wrote:

What happened to you? I thought that you were coming for a drink
tonight?
-- 

Regards
     Stephen


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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