Extending a Component vs. Passing an Object

2013-01-29 Thread Eric Cobb
I have a service CFC that calls my dao CFC a lot. Currently, I just pass in an object of the dao to the service's init() method and save it to the variables scope to be used throughout the service. But, I'm wondering if I would be better off having my service CFCs extend their dao's instead.

Re: Extending a Component vs. Passing an Object

2013-01-29 Thread Matt Quackenbush
A service object is a service object and a DAO is a DAO. They are two very different objects that serve two very different purposes in an application. Prefer composition over inheritance. In other words, keep doing what you're doing there (injecting the DAO). On Jan 29, 2013 8:37 AM, Eric Cobb

Re: Extending a Component vs. Passing an Object

2013-01-29 Thread Nathan Strutz
As usual, Matt Quack is spot on. I just wanted to add that extending is an IS-A relationship. If your service extended a DAO, you would say your service is a DAO. That's why Matt said they are very different objects. Is your service an object that talks directly to a database? No, it probably