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

Reply via email to