Dave Newton on 10/08/05 16:25, wrote:
(4) Dependency Injection/Configurability.
Classes that implement interfaces can be instantiated at runtime
allowing for config-file-level application modification. This can
translate into HUGE wins over the life of an application.
As a recent thread on DTOs pointed out having multiple implementations
of CRUD actions can be REALLY handy: I have an existing application that
uses Torque for persistence. I refactored out a lot of the typical CRUD
stuff into an interface, implemented a default Torque CRUD base class,
whung up a configuration file, and can now perform the most general CRUD
actions on my DB by giving a tablename String.
When I migrate this to Hibernate "all" I'll need to do is implement a
generic Hibernate CRUD base class (and perhaps some specializers for
particular tables/OMs), change the class names in my config file, and my
application will work as before without having to change any of my Actions.
Hold on a mo', you've lost me there. Haven't had my coffee yet -
if you have a whole package of DAOs (doing the CRUD stuff), all
inheriting the Torque base class which implements your DAO interface,
and you change over to Hibernate, then surely you must write a whole new
package of DAOs for Hibernate, not just the base class?
Obviously though the business tier is coded to the interface so is
unaffected.
Correct me if I'm wrong,
Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]