[NCLUG] programming question

Evelyn Mitchell efm at tummy.com
Sat Jun 30 13:19:22 MDT 2001


Hi Mike,

It helps to understand what resources you're trying to conserve.

The most expensive part of the system may be the time it takes you
to comprehend it. So, it's a good idea to create a solution that
is easy for you to understand.

One of the OO buzzwords which is supposed to make it easier for
programmers is encapsulation. This means that only the object which 
holds the data, and its close friends, should be able to modify the
data associated with an object. 

Another one is coherence. This would suggest that having a separate
object which contains only the information related to user registration
while using the 'public' access to the user object to pick up user
information would be the most coherent solution.

So, it's probably the case that creating a new object to hold
registration data is a good idea. Whether or not it extends
the user object or is a separate object is primarily a question of
taste and judgment.

Remember, if it's ugly, you can always change it later.

I've found Martin Fowler's writings on _Refactoring_ to be very
helpful in teaching how to make these sorts of decisions. He's
also got a good website www.refactoring.com

If you're conserving some other resource, like RAM or disk
space, well.. you'll just have to write it each way and profile it
in a 'most likely' environment.

Regards,
Evelyn

On Sat, Jun 30, 2001 at 12:20:20PM -0600, mike cullerton wrote:
> hey folks, hope the day is treating you well.
> 
> i've been using objects in some of my programs lately and am wondering about
> resources and tradeoffs.
> 
> say i have a user object maintaining user data. i also have some functions
> for allowing a user to register. i can add these functions to the user
> object, create a new object that extends the user object or create a new
> separate object.
> 
> so, what are the tradeoffs involved here?
> 
> thanks,
> mike
> 
>  -- mike cullerton
> 
> 
> _______________________________________________
> NCLUG mailing list
> NCLUG at nclug.org
> http://www.nclug.org/mailman/listinfo/nclug



More information about the NCLUG mailing list