Subject: Multiple forms handled by one .c
From: Steven Fisher <[EMAIL PROTECTED]>

A coworker and I are having a bit of an argument over whether or not
multiple forms should be handled by a single source file. I'm a big fan
of considering .c files to be objects, and trying to use an
object-oriented approach to developing forms. However, he's right that
handling related forms with a single .c file takes a lot less source
code (though I'm not really convinced it's that much less object code).

Easy answer.


Normally one form per C/C++ module. Reasons:
1) Some compiles will be shorter (not usually a big deal anymore!)
2) Easier to segment the program
3) Easier to debug. (you have a problem on form A, you don't need to look through the code for Form B and C)
4) Your static functions and variables have reduced scope, which cuts down the chance of hidden problems through accidental use or unexpected re-use.
5) If you name the C/C++ module after the form it is easier to see it once you have 50 or 80 forms defined!
6) Its considered better programming practise.


Exceptions:
1) If you have several related trivial forms, then there can be advantages to putting them in the same C/C++ module.
2) If you have a large amount for code for one form (say over 32KB) and you are using the Small memory model, and you can split the code into logical clumps, then you may have to support one form through several C/C++ modules.


Roger Stringer
Marietta Systems, Inc.  (www.RF-TP.com)


-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to