Subject: Re: good guide to programming style
To: None <netbsd-help@NetBSD.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-help
Date: 01/25/2007 08:10:40
On Tue, Jan 23, 2007 at 12:05:21AM -0500, George Georgalis wrote:
> At $WORK I support a group of analysts, who are generally
> very smart but they are not familiar with good programming
> practices. Mostly Window users getting a foot hold in unix by
> following examples from not so well written Fortran or R examples.
> 
> Unfortunately "good" programming is not something I can just define
> in a short training session. And, it's too easy (and painful) to
> just identify poor programming techniques or mistakes.  So, I'd
> like to put some kind of training together and was wondering if
> anyone here could provide some interesting websites to help the
> process?

IMHO you need to show why some things are 'bad practice', because 'good
practice' is what is left after you remove all the bad practice! and knowing
some bad practice will (should) help people identify others themselves.

I'd consider:
- KISS (keep it simple stupid)
- namespace preservation (and I don't mean C++ namespaces)
  eg all members of a structure have a short prefix, all gloabal defines
  and functions have a prefix.
- consistant and clear layout [1]

	David

[1] Considers the following fragment:
		....
		....
	}
	while (.......................................................................
	{
		....
		....
Is it the bottom of a 'do' loop or the top of a 'while loop'.

-- 
David Laight: david@l8s.co.uk