I'm migrating the backend portion of an application from a procedural
set of code to a cfc-based and hopefully more OO oriented design. For
this first go around I won't be using any of the MVC frameworks (the
front end is already written on this project) and I don't plan on
using any of the ORM's like Transfer quite yet.

Right now I'm sitting down and listing all the classes I'm going to
need and sketching out their methods and I've come up against a best
practices question.

Lets say I have a User object. The user has properties of id, first
name, last name, company and date of birth lets say.

Some setups I've seen would write a getter/setter (accessor/mutator)
for each property in that object along with a method to retrieve a
whole object and a set of objects. (at this point I'm using the words
object, bean and class interchangeably. I understand that I might be a
bit off there). So if I wanted to display a user with the id 10, I'd
say currentuser = User.getUser(10) which would return a struct with
the User object (bean, whatever). Then if I wanted that user's name,
I'd say currentuser.getFirstName(). If I wanted to change that users
first name to Bob, I'd say currentuser.setFirstName('Bob')

Other setups I've seen don't seem to write getters and setters for
each property but rather create methods that act on the object level.
So I'd say currentuser = User.getUser(10) and then if I wanted that
persons first name, I'd just reference it as currentuser.first_name
and if I wanted to set his name to Bob, I'd say currentuser.first_name
= 'Bob' and then call User.saveUser(10) and let it persist the change
that I made to the struct.

Is there a consensus on the best way to approach this? What are the
most useful tutorials out there for someone setting up their first go
around with OO while not using a framework?

Thanks,
Judah

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314203
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to