Next: Programming language
Up: Some programming recommendations
Previous: Some programming recommendations
  Contents
We recommend to use variable names which are easy to remember. We
also recommend to write ``robust'' code, because this piece of code
will be used over and over again, and it will be improved bit by bit.
Robust means the following for me:
- Things which can go wrong need to be tested during execution and
should lead to a program abort if the test fails. In my experience,
warnings are not useful here since in the end there will be so many
warnings that one will ignore them all. For example, one should test
for memory boundaries.
assert()
is a useful C/C++ command,
see man assert
.
- As a minimum rule for the use of subroutines:
Functionality which is used more than once inside a program has to
go into a subroutine.
Personally, I think that for simulation problems the strict
observation of these two rules are by far the most important aspects
of structured programming. This is independent from the particular
programming language; it is also independent from the
object-orientedness of the programming language although it may help.
Next: Programming language
Up: Some programming recommendations
Previous: Some programming recommendations
  Contents
2004-02-02