Understanding the Difference Between Coldspring and Transfer Objects

Recently I've been hard at work trying to understand the core principles of OO programming in ColdFusion. Last week Ben Nadel shared his experiences at a week-long course devoted to OOP with Hal Helms (the summary, which can be found here, also has links to his daily briefs). His posts opened my eyes to a couple of concepts that are now new to me, and since I'm on a new project I thought it'd be a great opportunity to try them out. As you know from my previous posts, I'm also trying to implement IoC (Coldspring) and ORM (Transfer-ORM) frameworks into my project, so figuring out where these two stand in relation to what I think I now know about OOP is my next challenge.

[More]

Related Blog Entries

Comments
Henry Ho's Gravatar
1.) I think we shouldn't pass Event into the Service layer. Service layer should be framework independent, so extract whatever you need out of the event object in Controller layer.

2.) Why don't you use decorator to add Register behavior to User?
# Posted By Henry Ho | 10/29/08 10:23 PM
Francois Levesque's Gravatar
Hi Henry,

Thanks for the comments. I'm pretty new to all of this, so any insight is welcome :).

1) I understand the reasoning behind this. However, where does i18n happen? In the controller? I feel like this and parsing values before passing them to the service layer will only bloat my controller. Any ideas on this?

2) That's a really good idea. Like I said, I'm pretty new to all this so I hadn't considered that option yet. In this case, then, is there even a need for a service layer? How will I enforce stricter validation (the user name doesn't already exist, etc.). Can the domain object (through Transfer and the decorators) know about all of this?

Again, thanks for your insight on this ;).
# Posted By Francois Levesque | 10/30/08 7:40 AM
Shawn Holmes's Gravatar
Regarding 1)

Have a set of CFC "Managers" that take your service upon init(). Build your managers to provide functionality to your application and which take 'event' as a parameter. This keeps your interface consistent from your app framework and coldspring, allows you to clean up any "dirty" data within the Manager that would otherwise bloat your controller, and keeps the service layer framework independent.
# Posted By Shawn Holmes | 10/30/08 6:36 PM
Francois Levesque's Gravatar
Thanks Shawn,

So if I understand you correctly, my controller should send the event to the manager, which would clean it up and ping the service layer. The service layer would then ask the domain object for it's data/properties?

controller > manager > service object > domain object?

By domain object, I mean using Transfer to retrieve, set and save data.
# Posted By Francois Levesque | 10/30/08 9:48 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner