i know you said you are not using frameworks but i recently done exactly what
you are doing (migrating procedural to OO) and tore my hair out not
understanding best practice etc..., as i suspect you are going through now
then someone on this forum told me to look into ModelGlue and ColdSpring
frameworks and all i can say is that it made it so simple for me to understand.
it guides you to understanding best practices, and gives you no choice but to
program in OO
you may think that it would take longer if you were to go into a framework
first but it actually makes it easier. i sat down with a colleague without
knowing anything about modelglue and coldspring and within 1 month we had
learned it, and completely redesigned our app based on OO.
in relation to your question, i use getters and setters and i have seen this
much more widely used that the other you pointed out
hope this helps
>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:314206
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4