On Tue, Jun 29, 2010 at 11:58 AM, Ajay Kumar <ajaykumarns(a)gmail.com> wrote:
I agree with Devan's view that,
*) There should be a separate middle layer which takes care of business logic
- One of the issues I faced when implementing the FIFO/LIFO
functionality is that, I had to interact with different curators.
In my case PoolCurator and EntitlementCurator. Since the
refresh functionality was implemented within the PoolCurator,
I had to write criteria queries within the PoolCurator class
instead of EntitlementCurator(Ideally all entitlement CRUD should be
done here). The later creates a cycle of dependencies between
different curators which ideally should not happen and should be
avoided. Another thing I would like to point out is that throughout
our code base, a lot of hibernate dependencies is sprinkled. I do not
know whether this would cause problems in the future.
*) The resource layer should delegate the call to the respective
business layer so that the number of dependencies will go down.
All business logic can be implemented here. It focuses the
functionality to a single layer and also makes it easy to co-ordinate
between different curators.
An unrelated concern I have is about the junit test cases in
candlepin. Should the test cases not be in the same package as the
class they are testing? (Right now, all test cases are in
com.fedoraproject.candlepin.*.test) .The idea is that you can test
protected methods if they are in the same package.
Sounds like most are in favor of a new layer in the middle for
business logic. I'm not positive this totally solves the circular
dependency problem, it will probably surface again even with three
layers, but in any case it should be much less frequent. We should get
a prototype out there, something we can code to as we go.
Cheers,
Devan
--
Devan Goodwin <dgoodwin(a)rm-rf.ca>
http://rm-rf.ca