I was just drafting a response, also highlighting the very cool call-method syntax - precisely because it really drove home - for me anyway - the ideal of listeners so dumb and simple that in many cases, you don't even need them at all. -Jason
On Wed, Sep 16, 2009 at 1:07 PM, Adrian Scott <[email protected]> wrote: > > Listeners versus services is a totally subjective topic, but my > thoughts on this are as follows: > > I like think of services as objects that should be able to stand on > their own assuming no Mach-II elements are present, e.g. you should be > able to access all of the functionality of your application without > having to first go through the Mach-II framework (listeners in > particular). This allows you to utilize all the same code and logic > at different levels, such as utilizing your services for remoting > purposes (such as webservices or Flex). Listeners to me should be a > fairly simple pass-through that collects data which exists within the > event scope and transfers it to the service. > > That being said, I'd recommend using the Mach-II 1.8 call-method > command as much as possible, since it really forces you to shed your > overuse of listeners and makes you really harness the power of having > your logic within services (see: > http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/MachII1.8CallMethodCommand). > > Assuming you've done all that, you are no longer married to the Mach- > II framework in order to run through your application's logic (not > that I would leave Mach-II... it's too rad). > > Adrian. > > On Sep 16, 8:14 am, Eric Cobb <[email protected]> wrote: >> In a recent Mach-II discussion on Listeners and Services >> (http://groups.google.com/group/mach-ii-for-coldfusion/browse_thread/t...), >> Joel Cox made the comment "Your listener *should* be fairly simple, just >> passing the necessary event args into the service. Let the service >> itself do the heavy lifting." As I thought about this comment, I >> realized that I may actually be using Listeners wrong. To be honest, I >> think I'm doing the exact opposite of what Joel suggests. In fact, I >> know I am after reading this quote in the Listeners Wiki entry: "It is >> important to mention that it is not recommended that any business logic >> appear here, but is kept outside of Mach-II." >> >> After reading through the Wiki entry I realize that you should use >> Listeners for getting Mach-II logic over to your Services, and keep that >> logic out of your model. In my (first) Mach-II application, I've been >> using Listeners a little differently. I've basically been using them to >> do the heavy lifting, with most of my business logic being in my >> Listeners instead of my Service components. My Service components >> really just have a few basic CRUD methods that interact with my >> Bean/DAO/Gateway components, and that's about it. >> >> So it looks like I need to reverse my thinking and get all of my >> business (non Mach-II) logic into my Service components. Does that >> sound about right? Since I am somewhat of a beginner to Mach-II, I >> would love to see a discussion on how some of you use Listeners to >> interact with your Services. >> >> -- >> Thanks, >> >> Eric Cobbhttp://www.cfgears.com > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to Mach-II for CFML list. 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/mach-ii-for-coldfusion?hl=en SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/ Wiki / Documentation / Tickets: http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/ -~----------~----~----~----~------~----~------~--~---
