[NCLUG] programming question

Charles Clarke clarke at clarkecomputer.com
Sat Jun 30 18:51:25 MDT 2001


On Sat, 30 Jun 2001, mike cullerton wrote:

> this is a theoretical question. i'm wondering, is there a difference, in
> general, programmatically speaking, between having one large object, two
> disjoint objects or an object that extends another object.

Yes.  What it is exactly depends on the programming language.

Normally, one large object will take reasonable memory and be faster
executing.  It may be harder to understand or reuse though. 

Two disjoint objects can lead to problems later if you need to modify some
of the common code.  Bad for reuse.  Will take less space for the smaller
object of the two.  Executes as fast(possibly faster) than one large.

One object extending the other will generally use more space, though with
a smart language it won't.  It will also generally use more time
(dereferencing to find the base class; the extra space is used by the
pointers), but again, with a smart language, it won't.  It is much easier
to understand conceptually though and is the way I would recommend you
code unless you have a strong reason (unacceptable performance, etc.) to
do otherwise. 

charles

--------------------------------------------------------------------------
 Domain hosting from $15/month with error log analysis and link checking.
 http://www.clarkecomputer.com/sig.html       domains at clarkecomputer.com




More information about the NCLUG mailing list