Well, Cocoon works pretty well, and it's based on Avalon (another IoC framework, though supposedly not as light-weight as Spring). From the little I've worked with Cocoon it seems to work fairly well.
-James On Sat, 2004-12-04 at 00:25 +0100, Oliver Zeigermann wrote: > Hi John, > > thanks a lot this really makes sense to me. Thanks for explaining with > this simple example. > > I was just wondering, does this really work? For real? Isn't it too > complx? Can you still debug this? Why having all these different > implementations? Maybe I am too suspicious, but I am always alert when > I hear introspection, AOP and magic. > > Thanks, > > Oliver > > Anyway, as other people know I am no friend > > On Fri, 3 Dec 2004 13:55:00 -0500, John Gilbert <[EMAIL PROTECTED]> wrote: > > The key is to code to interfaces and pojo objects as much as possible > > and rely on the framework to find the implementation. This way the > > business logic is fully decoupled from the platform. For example, a > > junit test could be written to test the business logic without the app > > server. > > > > Here is an overly simplified example. Basically, my pojo and action > > classes can be run anywhere. The interface impl is plugged as necessary. > > > > class MyPojo { > > private String name; > > public String getName() { return name; } > > public void setName(String name) { this.name = name; } > > } > > > > interface MyService { > > public doTheWork(MyPojo pojo); > > } > > > > class MyServiceJdoImpl implements MyService {...} > > class MyServiceHibernateImpl implements MyService {...} > > class MyServiceEntityBeanImpl implements MyService {...} > > class MyServiceTestImpl implements MyService {...} > > ...etc... > > > > // the spring framework reads its descriptor file to determine the right > > > > // service implementation and uses some combination of introspection and > > AOP > > // to call setService() on the action. > > // This is the magic I haven't delved into yet. > > class MyAction(...) { > > private MyService svc; > > public void setService(MyService svc) {...} > > public ... execute(...) { > > ... > > svc.doTheWork(pojo); > > ... > > } > > } > > > > // in my unit test I can do all the setup and test the functionality > > // or use spring here also I think. > > class MyUnitTest { > > > > public void testService() { > > ... > > MyAction action = new MyAction(); > > MyService svc = new MyServiceTestImpl(); > > action.setService(svc); > > action.execute(...); > > } > > } > > > > How did I do? Does this make sense? I definitely like it as a design > > pattern, but I'm not completely sold on needing a full framework for it. > > > > The jury is still out. But, it does sell a lot of books. ;-) > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]