I'm somewhat OK with having finders in DAOs be publicly accessible --
mostly because it's unlikely that we'll ever 'not' be in a
transaction (save test code which is have been incorrectly using
DAOs.) Mutators in DAOs (save, evict, etc.) should definitely not be
public -- it's the job of the managers to do those things.
Note, if we actually made all the methods in the DAO protected, it
would be impossible for programmers writing test code to do the wrong
thing. I like that mentality -- making it impossible for the
programmer to do the wrong thing.
-- Jon
On Nov 16, 2006, at 10:47 AM, Charles Lee wrote:
> 1) Agreed
>
> 2) Didn't realize that we had this agreement already. I definitely
> agree with it conceptually, but not sure if practically this can be
> enforced 100% if there are some managers who need to call into DAOs
> of other subsystems. In such cases, I suppose then we can
> introduce accessors through the appropriate manager APIs, but
> wonder if that creates a whole lot of additional work, because
> you'd have to create another session bean from whatever session
> bean (or maybe even message driven bean) you are in just to access
> the DAO. I suppose if we leave room to bend the rule when needed,
> then we can go through the DAOs and just change the accessibility
> for all of the APIs and see.
>
> Charles