With Service objects there is not much to learn. Even the pattern in Fowlers book POEAA - http://martinfowler.com/eaaCatalog/serviceLayer.html only takes up a few pages. Think of them as an API or Facade to your business objects (Beans, DAO, Gateways etc). Use them to add things like <cftransaction>, error handling, logging (ie Application-specific stuff) then move on :-)
And before someone says it once you go Coldspring you have something called AOP that can do some of these things we do in Service objects. But thinking Service -> Gateway etc isn't a good route for learning OO. It shows you composition (services associated with DAO's), encapsulation (DAO's encapsulate database access, bean getters encapsulate data) but shouldn't be your main focus. Alan ________________________________________ From: [email protected] [EMAIL PROTECTED] On Behalf Of wkolcz [EMAIL PROTECTED] Sent: 06 May 2008 14:19 To: [email protected] Subject: [CFCDEV] Re: Help in learning service objects: How to use Thanks for the heads up. I have been deving with MG,ColdSpring, and Reactor for about 1 1/2 years and like the ORM. Haven't really used Transfer yet. I would like to know more behind the scenes for my own projects. My 'productivity' is still either using an ORM or just working with DAOs and Gateways directly. Service Objects are the next on my 'things to learn list'. ________________________________ From: Nando <[EMAIL PROTECTED]> Sent: Tuesday, May 06, 2008 6:08 AM To: [email protected] Subject: [CFCDEV] Re: Help in learning service objects: How to use I believe there's a tradeoff here so far as learning OO goes. Using a combination of MG, Transfer and Coldspring for instance will give you a good example to learn from. Once you see how things are done using the frameworks, you may be in a better position to architect something on your own. Speaking from experience, it can take a very long time to put all the pieces together on your own, years. And if you need to be productive in that time, well, that's where I'd recommend that someone new to this jump into what seems like the deep end and use these frameworks for awhile. That said, you need to know at least the basics of using components to use the frameworks. Attempting to build something without the frameworks may seem like a shallower learning curve, but what you may find down the road, once you get your basic business object, DAO and/or gateway working is that you don't know how to progress from there. You'll be in deep water without knowing it. Your applications take you longer to build, it seems like you've learned something, but now what? If that's as far as we get, from a productivity standpoint, we should just stay with procedural code. The frameworks give us the space to be apprentices of OO, which is good, rather than taking too large a step, attempting to be a master of OO in too short a time, and usually, for most of us, without any personal guidance. They also allow us to focus on our client's needs, rather than get lost in abstract architectural questions. I find Transfer in particular allows me to be much more productive than I would be using procedural code. If I were to guide someone, I'd suggest that they dabble in attempting to build a simple application on their own, just to get the hang of using CFC's in an object oriented manner. But just dabble. Jump into using the frameworks as soon as you can, even if it seems like the deep end. It will probably save you from developing a code base that you need to rebuild from scratch several times over! If you are staking your finances on such a code base, I think you'll be much better off using the frameworks rather than on your own. On Tue, May 6, 2008 at 1:55 PM, wkolcz <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote: I've been working with Reactor, but thought it'd be better to learn how these things really work before I get too much into an ORM that does it mostly for me. ________________________________ From: Nando <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> Sent: Tuesday, May 06, 2008 4:49 AM To: [email protected]<mailto:[email protected]> Subject: [CFCDEV] Re: Help in learning service objects: How to use Ah, there's my cue. Transfer recommended! Another option is Transfer (before someone recommends it :-) ) Alan ________________________________________ From: [email protected]<mailto:[email protected]> [EMAIL PROTECTED]<mailto:[email protected]>] On Behalf Of wkolcz [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>] Sent: 06 May 2008 12:36 To: [email protected]<mailto:[email protected]> Subject: [CFCDEV] Help in learning service objects: How to use I downloaded and installed Brian Rinaldi's Illudium PU-36 Code Generator. It produced a DAO, a Gateway, a bean, and a service object. I am attempting to learn how a service object works, or, more imporantly, how to use the service object. It comes with the following functions. (mine happens to be releasesServices.cfc) init (takes an instance of the DAO and the Gateway) createreleases getreleases getreleasess savereleases deletereleases So basically, I am getting the DAO (create,get,save,delete) and a Gateway (getreleasess)? How can I call the gateway to return a list of records. Or, more important, how can I use the results on my view? Its returned as an array. What am I missing. I need the education :-) I can setting my controller to: <cfset RDAO = createObject("component", "medPortal.apps.newsroom.model.releases.releasesDAO").init("prmc-media_asql")> <cfset RGW = createObject("component", "medPortal.apps.newsroom.model.releases.releasesGateway").init("prmc-media_asql")> <cfset RS = createObject("component", "medPortal.apps.newsroom.model.releases.releasesService").init(#RDAO#, #RGW#)> <cfset allReleases = RS.getreleasess()> Here is the full function: <cffunction name="getreleasess" access="public" output="false" returntype="array"> <cfargument name="ID" type="Numeric" required="false" /> <cfargument name="urllink" type="String" required="false" /> <cfargument name="linktext" type="String" required="false" /> <cfargument name="story" type="String" required="false" /> <cfargument name="summary" type="String" required="false" /> <cfargument name="keyword1" type="String" required="false" /> <cfargument name="keyword2" type="String" required="false" /> <cfargument name="keyword3" type="String" required="false" /> <cfargument name="keyword4" type="String" required="false" /> <cfargument name="um_department" type="String" required="false" /> <cfargument name="photo" type="String" required="false" /> <cfargument name="hiresphoto" type="String" required="false" /> <cfargument name="releaseDate" type="Date" required="false" /> <cfargument name="rss_feed" type="String" required="false" /> <cfargument name="contactName" type="String" required="false" /> <cfargument name="contactEmail" type="String" required="false" /> <cfargument name="contactPhone" type="String" required="false" /> <cfargument name="guestEmail" type="String" required="false" /> <cfargument name="guestName" type="String" required="false" /> <cfargument name="subTitle" type="String" required="false" /> <cfargument name="city" type="String" required="false" /> <cfargument name="videoCode" type="String" required="false" /> <cfargument name="audioCode" type="String" required="false" /> <cfargument name="ExpertName" type="String" required="false" /> <cfargument name="ExpertURL" type="String" required="false" /> <cfargument name="learnMoreText" type="String" required="false" /> <cfargument name="learnMoreURL" type="String" required="false" /> <cfargument name="studyURL" type="String" required="false" /> <cfargument name="reportURL" type="String" required="false" /> <cfargument name="topStory" type="Boolean" required="false" /> <cfargument name="photoCaption" type="String" required="false" /> <cfargument name="spanishURL" type="String" required="false" /> <cfargument name="defaultLogo" type="String" required="false" /> <cfreturn variables.releasesGateway.getByAttributes(argumentCollection=arguments) /> </cffunction> -- Nando M. Breiter The CarbonZero Project CP 234 6934 Bioggio Switzerland +41 76 303 4477 [EMAIL PROTECTED] -- Nando M. Breiter The CarbonZero Project CP 234 6934 Bioggio Switzerland +41 76 303 4477 [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
