• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

modelling

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I would like some advice on how to model the the following if anyone could help it would be appreciated.

I would like to use composition but decoupling it as much as possible.

With Spring this is possible because the instantiation is done via Data Injection. So I as long as I use an interface as a reference and inject different classes which implement that interface this can be achieved.

What I would like to know is how this can be achieved without DI.

Regards,

Chris
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christopher Au:
I would like to use composition but decoupling it as much as possible.



What do you mean by "as much as possible"? And why do you want to do that?

With Spring this is possible because the instantiation is done via Data Injection. So I as long as I use an interface as a reference and inject different classes which implement that interface this can be achieved.

What I would like to know is how this can be achieved without DI.



You can use dependency injection without using a framework like Spring. For example, the injection could simply be hard coded in your "main method".

It's hard to get more specific without knowing more about your problem...
 
Christopher Au
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

lets say I have a model which has classes for user details, addresses, some marketing etc.

Let's say I have a formbean which collects information from the 3 different classes.

What is the best approach to instantiate the model beans and populate them from the form bean whilst allowing for loose coupling. What I mean by loose coupling is ensuring that if I extend address and add a couple more fields I can still use the subclass with minimal problems.

Sorry if this sounds a bit messy

Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic