[ic] how to write code

Marc Brevoort interchange-users@icdevgroup.org
Thu Mar 6 10:18:00 2003


On Wed, 2003-03-05 at 16:16, Grant wrote:
> I'm going to go over all of my code soon and clean it up, 
> but I'd like to have some idea of the way things *should* be done
> before I do.
> 
> - Grant

It is difficult to go over all details to keep in mind for 'clean'
programming, but generally when writing any type of code it helps to
think of a program as building blocks. Each block has a functionality,
producing a predictable result based on the input. The first thing each
block should do is check if the input given to it makes sense.

As you already have written some code, probably you can identify several
blocks that have the same function. Try to combine these into
'programming language' functions (by making new usertags or creating
library functions), this will allow you to eliminate redundancy by
taking out double copies of your code, reducing maintenance.

Finally, when working with Interchange, I feel it's almost vital to know
at least a bit of Perl. I find it helps me solve problems that ITL has
difficulty handling. It is possible to write pretty cryptic code with
perl, and I'm sure real perl gurus can write complete web content
management systems in a single line of code, but you don't *have* to
write that way. Keeping things tidy is usually a good idea.

There is more to it than I can tell in this short message, but a lot
comes down to discipline in following (your own set of) best practices.
Follow the road that consistently gives you the best results.

Good luck!

-- 
e-mail:	marc.brevoort@armazemdedados.com
web:	http://www.armazemdedados.com

Armazem de Dados, Informatica, Lda
Dep. Desenvolvimento
Tel. +351 21 910 83 10 / Fax. +351- 21 910 83 19