Thread overview
What do you think about my D style guide? - CLAYTEK_3D_STYLEGUIDE.d
Aug 02, 2004
clayasaurus
Aug 02, 2004
Stewart Gordon
Aug 02, 2004
Andy Friesen
August 02, 2004
Hello. I've been working on a project and something that is setting me back is to have a good consistent style to code with.

I've created a style guide for myself and am posting it here for comments and critiques.

Some of you will have differing opinions on things which may be constructive. Also, I'm open to any additional ideas.

Thanks all for your time

(see attachment)
(http://svn.dsource.org/svn/projects/claytek/trunk/CLAYTEK_3D_STYLEGUIDE.d)


August 02, 2004
hungarian notation must die!  ;)

i hate to say it but your style annoys me.  my style would probably be as equally annoying to you.  which is why i never really saw the point in universal coding styles, unless there are several people working on the same project!


August 02, 2004
clayasaurus wrote:
> Hello. I've been working on a project and something that is setting me back
> is to have a good consistent style to code with. 
> 
> I've created a style guide for myself and am posting it here for comments
> and critiques. 
> 
> Some of you will have differing opinions on things which may be constructive.
> Also, I'm open to any additional ideas.
> 
> Thanks all for your time

Bear in mind that this is all purely subjective.  Sticking with a standard is more important than what precise standard is used.

So...

I *hate*, loathe, despise, and abhor (in that precise order, no less) variable decorations of all description.  Variable names should be unique, beautiful little snowflakes.  In particular, locals and parameters are never used far from their declaration anyway.

Structs are basically useful for three things: communication with C, value type semantics, and as a speed hack.  (remember the first rule of optimization: /Don't/)

Keep in mind that the public interface of a class is going to be referred to quite a lot more than its internals: put private things at the end, public at the top.

And most importantly:

Break your own rules if there's a good enough reason to.  The entire point is to write code that's easy to read.

 -- andy
August 02, 2004
Jarrett Billingsley wrote:

> hungarian notation must die!  ;)
> 
> i hate to say it but your style annoys me.  my style would probably be as
> equally annoying to you.  which is why i never really saw the point in
> universal coding styles, unless there are several people working on the same
> project!

My department doesn't seem to be able to agree on a style.  Maybe it's time to get together.  The only trouble is that there are different code editors around - those that use tabs and those (Emacs) that indent by two spaces.  And some of the others' styles are already abominable to me.  Like economising on spaces, and making every blank like a comment....

(This is in Fortran 90 - it appears that the one bit of coding style in the department is to use this!)

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.