Re: basic cfc/oo design question

2008-10-25 Thread Larry Lyons
>Larry,
>Awesome. Thanx.
>
>Do you know if the Poseidon UML Community version will export an XMI 1.1
>file?
>
>~G~
>
>If not any recommendations for a OSS and/or Free UML App?
>
>

>From what I understand Brian developed the app using Poseidon UML. So yes I 
>assume it would work.

As for UML reccomendations, I mostly use the UML plugin for myEclipse ($30 a 
year) and Magic Draw (much more expensive). 

There's also ArgoUML which is FOSS http://argouml.tigris.org/

regards,
larry


~|
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:314374
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-24 Thread Gerald Guido
Larry,
Awesome. Thanx.

Do you know if the Poseidon UML Community version will export an XMI 1.1
file?

~G~

If not any recommendations for a OSS and/or Free UML App?

On Fri, Oct 24, 2008 at 4:19 PM, Larry Lyons <[EMAIL PROTECTED]> wrote:

> >All fine point there Gerald, thank you. I've looked at Illudium in the
> >past and plan on doing so again for this project. Right now though I'm
> >trying to map out all my classes in UML to make sure that I have it
> >together conceptually, then move to the actual coding part. The
> >database already exists from the previous iteration of the project
> >though I plan on modifying parts of it. So I will most likely start at
> >the conceptual level and work down, then start generating from the
> >persistence level and work up, then try and hopefully meet those two
> >somewhere in a happy middle :)
> >
> >Judah
>
> Judah,
>
> You may want to check out Brian Kotek's CFCStubGenerator,
> http://cfcstub.riaforge.org/. Basically what you do is develop your class
> diagram in your favourite UML app. Then export it as an XMI 1.1 file. Next
> run the CFCStubGenerator app and import your xmi file. The stub generator
> will output stubs with all you CFC's, as well as many other useful stuff
> (xml files for MG and Coldspring, test cases for CFCUnit or CFUnit etc.).
>
> hth,
> larry
>
> 

~|
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:314358
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: basic cfc/oo design question

2008-10-24 Thread Larry Lyons
>All fine point there Gerald, thank you. I've looked at Illudium in the
>past and plan on doing so again for this project. Right now though I'm
>trying to map out all my classes in UML to make sure that I have it
>together conceptually, then move to the actual coding part. The
>database already exists from the previous iteration of the project
>though I plan on modifying parts of it. So I will most likely start at
>the conceptual level and work down, then start generating from the
>persistence level and work up, then try and hopefully meet those two
>somewhere in a happy middle :)
>
>Judah

Judah,

You may want to check out Brian Kotek's CFCStubGenerator, 
http://cfcstub.riaforge.org/. Basically what you do is develop your class 
diagram in your favourite UML app. Then export it as an XMI 1.1 file. Next run 
the CFCStubGenerator app and import your xmi file. The stub generator will 
output stubs with all you CFC's, as well as many other useful stuff (xml files 
for MG and Coldspring, test cases for CFCUnit or CFUnit etc.).

hth,
larry 

~|
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:314355
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-24 Thread Richard White
as an extra helper i would say if you are migrating from procedural to OO i 
would suggest MG, as it is fantastic and forces you down an OO route. 

i havent done too much research on the others but when i was deciding, i posted 
a message on this forum and was told that MG is def more OO than others


>I'm planning on using one of the MVC frameworks (probably MG, but I'll
>look at Mach ii and OO Fusebox again as well) for a seperate project
>that can be built from the ground up. This project has enough quirks
>(like an existing url rewriter scheme) that I'd prefer not to try and
>shoehorn in a whole framework.
>
>I agree though that having a framework that you make yourself use will
>certainly aid in getting it "down".
>
>As for the getters/setters, I just read a posting and comments
>discussion on Brian Kotek's blog that helps clarify the getter/setter
>argument and I think I'll go ahead and do the extra work for
>getters/setters.
>
>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:314338
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-22 Thread Judah McAuley
Agreed, this is something I ran into before and is definitely
something that often haunts me into indecision. That is one of the
reasons I'm not doing a framework right now. I figure if I can
abstract out my functionality into a set of classes and get those
classes implemented as cfc's, I'll have done plenty for a first go
around.

Then I can move onto a framework for the next, more discrete, project
and try to increase my OO-indoctrination depth.

Judah

On Wed, Oct 22, 2008 at 10:43 AM, Gerald Guido <[EMAIL PROTECTED]> wrote:
> One thing I would watch out for is concept overload. I think the single most
> difficult thing for me was sifting the VAST amounts of information. One of
> the problems I ran into was finding tutes and examples that did *one thing
> only* and not mixing concepts like using MachII and ColdSpring together. So
> when you look at the code examples you can't figure out which parts were
> MachII and which were ColdSpring.
>
> I would recomend taking things one step at a time instead of trying to
> abstract your database while trying to work it into a Framework. I ended up
> thinking myself stupid and just got frustrated. Pick a single task/Concept
> and figure it out and then move on to another.
>
> HTH
> G
>

~|
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:314262
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-22 Thread Gerald Guido
One thing I would watch out for is concept overload. I think the single most
difficult thing for me was sifting the VAST amounts of information. One of
the problems I ran into was finding tutes and examples that did *one thing
only* and not mixing concepts like using MachII and ColdSpring together. So
when you look at the code examples you can't figure out which parts were
MachII and which were ColdSpring.

I would recomend taking things one step at a time instead of trying to
abstract your database while trying to work it into a Framework. I ended up
thinking myself stupid and just got frustrated. Pick a single task/Concept
and figure it out and then move on to another.

HTH
G


On Wed, Oct 22, 2008 at 12:57 PM, Judah McAuley <[EMAIL PROTECTED]>wrote:

> All fine point there Gerald, thank you. I've looked at Illudium in the
> past and plan on doing so again for this project. Right now though I'm
> trying to map out all my classes in UML to make sure that I have it
> together conceptually, then move to the actual coding part. The
> database already exists from the previous iteration of the project
> though I plan on modifying parts of it. So I will most likely start at
> the conceptual level and work down, then start generating from the
> persistence level and work up, then try and hopefully meet those two
> somewhere in a happy middle :)
>
> Judah
>
>
-- 
Gerald Guido
http://www.myinternetisbroken.com

"Neurotics build castles in the air, psychotics live in them. My mother
cleans them."
-- Rita Rudner


~|
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:314261
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-22 Thread Matt Quackenbush
Just to make sure you're aware of its existence, I would suggest taking a
look at ColdBox as well.

http://www.coldboxframework.com/
http://www.12robots.com/index.cfm/2008/9/21/Building-an-Application-with-ColdBox-and-ColdSpring--Part-1


On Wed, Oct 22, 2008 at 12:02 PM, Judah McAuley wrote:

> I'm planning on using one of the MVC frameworks (probably MG, but I'll
> look at Mach ii and OO Fusebox again as well) for a seperate project
> that can be built from the ground up. This project has enough quirks
> (like an existing url rewriter scheme) that I'd prefer not to try and
> shoehorn in a whole framework.
>
> I agree though that having a framework that you make yourself use will
> certainly aid in getting it "down".
>
> As for the getters/setters, I just read a posting and comments
> discussion on Brian Kotek's blog that helps clarify the getter/setter
> argument and I think I'll go ahead and do the extra work for
> getters/setters.
>
> 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:314259
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-22 Thread Judah McAuley
I'm planning on using one of the MVC frameworks (probably MG, but I'll
look at Mach ii and OO Fusebox again as well) for a seperate project
that can be built from the ground up. This project has enough quirks
(like an existing url rewriter scheme) that I'd prefer not to try and
shoehorn in a whole framework.

I agree though that having a framework that you make yourself use will
certainly aid in getting it "down".

As for the getters/setters, I just read a posting and comments
discussion on Brian Kotek's blog that helps clarify the getter/setter
argument and I think I'll go ahead and do the extra work for
getters/setters.

Thanks,
Judah

On Tue, Oct 21, 2008 at 4:56 PM, Richard White <[EMAIL PROTECTED]> wrote:
> 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
>

~|
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:314255
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: basic cfc/oo design question

2008-10-22 Thread Judah McAuley
Thanks for this advice Mike. I'd forgotten about the cfcdev mailing
list, I'll go sign up for that now. Fortunately for me, this site is
not a high traffic site. These are back end business process tools, so
I'm really refactoring to increase the sensibility and maintainability
of the code. I will hopefully also be getting some other developer
resources on this project in the future and they will likely be either
C# or Java guys, so moving to a more OO framework will make it easier
to bring them on I think.

Judah

On Tue, Oct 21, 2008 at 4:29 PM, Mike Chabot <[EMAIL PROTECTED]> wrote:
> This is a very big topic and you might get a more in-depth response if
> you posted your question on the cfcdev list, which focuses on CFCs and
> OOP.
>
> A word of caution though if you are approaching OOP for the first time
> is that CF isn't an ideal OOP language. Your rewrite might end up
> doing more harm than good if you aren't careful, especially if it is a
> high-traffic site. The code I write in Java and .NET isn't code that I
> would write in ColdFusion. In my experience, ColdFusion suffers
> significant performance and RAM hits when you instantiate numerous
> objects, even simple ones, unless you instantiate them using Java code
> embedded inside of CF. To counteract this performance hit I favor
> light-weight pseudo Data Transfer Objects or pseudo Value Objects
> which focus on data storage, and move the functions to helper classes.
> By "pseudo" I mean structures (StructNew() type structures) that
> mirror DTOs or VOs that you can cast to object instances if necessary.
> Again, I do this because CF isn't good at handling objects and I find
> this technique to work well given that limitation, not because this is
> the purest OOP way to do things. There are plenty of healthy
> discussions on the best techniques in the cfcdev mailing list
> archives. If you prefer a pure OOP design for your site I think you
> will find ColdFusion to be limiting as you dig deeper into this topic.
>
> -Mike Chabot
>
> On Tue, Oct 21, 2008 at 6:35 PM, Judah McAuley <[EMAIL PROTECTED]> wrote:
>> 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:314254
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: basic cfc/oo design question

2008-10-22 Thread Judah McAuley
All fine point there Gerald, thank you. I've looked at Illudium in the
past and plan on doing so again for this project. Right now though I'm
trying to map out all my classes in UML to make sure that I have it
together conceptually, then move to the actual coding part. The
database already exists from the previous iteration of the project
though I plan on modifying parts of it. So I will most likely start at
the conceptual level and work down, then start generating from the
persistence level and work up, then try and hopefully meet those two
somewhere in a happy middle :)

Judah

On Tue, Oct 21, 2008 at 5:33 PM, Gerald Guido <[EMAIL PROTECTED]> wrote:
>>>Your rewrite might end up doing more harm than good if you aren't careful,
>
>
> That reminds me of a comment by Sean Corfield on the alagad blog:
> "And a bad OO design will punish you more than any bad procedural design
> you've ever conceived."
>
> http://www.alagad.com/go/blog-entry/what-does-object-oriented-programming-do-for-me
>
> I know what he meant first hand ;-). OO can be a *harsh* master.
>
> Not to detour you from the pursuit but it will take time. In an interview,
> Hal Helms said that it takes about 6-12 months to make the transition to OO.
> I have been beating my head against OO for the last 18 months and it started
> to really pay off after about 6-7 months. It WILL pay off, you just need to
> keep at it. After a shile you just stert seeing thing differently. It is a
> restructuring of how you think and approach programming. They call it
> "cognitive restructuring" in psychology.
>
> As for what to do? Start *doing*:  research, read, learn, try, screw up, ask
> questions, learn some more, rinse. Repeat as needed.
>
> Go check out Ben Nadel's series on OO.
> http://www.bennadel.com/blog/1275-OOPhoto-Another-Attempt-At-Learning-Object-Oriented-Programming-OOP-In-ColdFusion.htm
>
> What I did was to try to figure out how to use (abstract my database) the
> Illudium PU-36 Code Generator. That helped me set a goal and get over the
> initial hurtle in a pragmatic manner.
>
> http://code.google.com/p/cfcgenerator/
>
> Where my head is at these days is to abstract everything to it's most basic
> form. Like Einstein said "Everything should be as simple as it is, but not
> simpler."
>
> HTH... Best of luck.
>
> G
>

~|
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:314253
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: basic cfc/oo design question

2008-10-21 Thread Gerald Guido
>>Your rewrite might end up doing more harm than good if you aren't careful,


That reminds me of a comment by Sean Corfield on the alagad blog:
"And a bad OO design will punish you more than any bad procedural design
you've ever conceived."

http://www.alagad.com/go/blog-entry/what-does-object-oriented-programming-do-for-me

I know what he meant first hand ;-). OO can be a *harsh* master.

Not to detour you from the pursuit but it will take time. In an interview,
Hal Helms said that it takes about 6-12 months to make the transition to OO.
I have been beating my head against OO for the last 18 months and it started
to really pay off after about 6-7 months. It WILL pay off, you just need to
keep at it. After a shile you just stert seeing thing differently. It is a
restructuring of how you think and approach programming. They call it
"cognitive restructuring" in psychology.

As for what to do? Start *doing*:  research, read, learn, try, screw up, ask
questions, learn some more, rinse. Repeat as needed.

Go check out Ben Nadel's series on OO.
http://www.bennadel.com/blog/1275-OOPhoto-Another-Attempt-At-Learning-Object-Oriented-Programming-OOP-In-ColdFusion.htm

What I did was to try to figure out how to use (abstract my database) the
Illudium PU-36 Code Generator. That helped me set a goal and get over the
initial hurtle in a pragmatic manner.

http://code.google.com/p/cfcgenerator/

Where my head is at these days is to abstract everything to it's most basic
form. Like Einstein said "Everything should be as simple as it is, but not
simpler."

HTH... Best of luck.

G


On Tue, Oct 21, 2008 at 7:29 PM, Mike Chabot <[EMAIL PROTECTED]> wrote:

> This is a very big topic and you might get a more in-depth response if
> you posted your question on the cfcdev list, which focuses on CFCs and
> OOP.
>
> A word of caution though if you are approaching OOP for the first time
> is that CF isn't an ideal OOP language. Your rewrite might end up
> doing more harm than good if you aren't careful, especially if it is a
> high-traffic site. The code I write in Java and .NET isn't code that I
> would write in ColdFusion. In my experience, ColdFusion suffers
> significant performance and RAM hits when you instantiate numerous
> objects, even simple ones, unless you instantiate them using Java code
> embedded inside of CF. To counteract this performance hit I favor
> light-weight pseudo Data Transfer Objects or pseudo Value Objects
> which focus on data storage, and move the functions to helper classes.
> By "pseudo" I mean structures (StructNew() type structures) that
> mirror DTOs or VOs that you can cast to object instances if necessary.
> Again, I do this because CF isn't good at handling objects and I find
> this technique to work well given that limitation, not because this is
> the purest OOP way to do things. There are plenty of healthy
> discussions on the best techniques in the cfcdev mailing list
> archives. If you prefer a pure OOP design for your site I think you
> will find ColdFusion to be limiting as you dig deeper into this topic.
>
> -Mike Chabot
>
> On Tue, Oct 21, 2008 at 6:35 PM, Judah McAuley <[EMAIL PROTECTED]>
> wrote:
> > 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 ap

Re: basic cfc/oo design question

2008-10-21 Thread Richard White
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


Re: basic cfc/oo design question

2008-10-21 Thread Mike Chabot
This is a very big topic and you might get a more in-depth response if
you posted your question on the cfcdev list, which focuses on CFCs and
OOP.

A word of caution though if you are approaching OOP for the first time
is that CF isn't an ideal OOP language. Your rewrite might end up
doing more harm than good if you aren't careful, especially if it is a
high-traffic site. The code I write in Java and .NET isn't code that I
would write in ColdFusion. In my experience, ColdFusion suffers
significant performance and RAM hits when you instantiate numerous
objects, even simple ones, unless you instantiate them using Java code
embedded inside of CF. To counteract this performance hit I favor
light-weight pseudo Data Transfer Objects or pseudo Value Objects
which focus on data storage, and move the functions to helper classes.
By "pseudo" I mean structures (StructNew() type structures) that
mirror DTOs or VOs that you can cast to object instances if necessary.
Again, I do this because CF isn't good at handling objects and I find
this technique to work well given that limitation, not because this is
the purest OOP way to do things. There are plenty of healthy
discussions on the best techniques in the cfcdev mailing list
archives. If you prefer a pure OOP design for your site I think you
will find ColdFusion to be limiting as you dig deeper into this topic.

-Mike Chabot

On Tue, Oct 21, 2008 at 6:35 PM, Judah McAuley <[EMAIL PROTECTED]> wrote:
> 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:314205
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


basic cfc/oo design question

2008-10-21 Thread Judah McAuley
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