Ray, forgive me for using your post as a platform for launching a
rant...

The issue (which seems to me is in danger of getting lost) is one of a
public interface (or API). There is nothing wrong with having public
getters and setters IF that is part of what your API is meant to
provide. There are two ways of abusing this:

1. Provide getters for instance variables when what you should be
providing is a method that may USE instance variables to return more
meaningful info. For example, something like a Circle CFC may/may not
need getRadius(), but the designer should ask whether something like
getArea() is really what s/he wants exposed as part of the interface to
that CFC. It's all about encapsulation.

2. Reflexive public getters/setters. Not all instance variables need to
be exposed. Again, it's a question of whether such info should be part
of the interface to that CFC. That doesn't preclude having private
getters and setters for use by other methods of a CFC.

Hal Helms
See halhelms.com for classes in...
Java for ColdFusion Programmers
Fusebox 4
Mach-II
OO Applications with CFCs

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Raymond Camden
Sent: Monday, September 15, 2003 1:49 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Getters and Setters WAS: DB and OO question


> 
> Adding unnecessary set/get methods will likely encourage future
> developers to misuse your classes...

Could one say that the this argument can be broken down to, do not use
unnecessary methods, which is something we should know anyway, but tend
to forget when it gets to methods that relate to object properties?

-Ray


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to