Hello people, I am hoping that some of you can point me in the right direction with a small design problem I am having. I'll probably describe it very badly so please stick with me ;)
I like the idea of the value object design pattern, it alows a back end component to create objects for me which I can then pass around the enterprise without their needing knowledge about how or where the information comes from. The problem I am having is in designing a factory component that produces customer Value objects. Each customer has the usual information, title, given name, family name etc, but can have a number of addresses too, i.e. shipping, billing, home, office etc. So I have created an address object, and one of the properties in customer is a collection of addresses. The problem is that in some of my JSPs I would like to just have a drop down list of customers, which will be huge (not my idea, customer requirement), so I don't really want the added traffic of transporting around a load of address objects that wont be used. So the next thought was to leave the addresses out of the customer Value Objects and add a new method into the factory to look up the addresses for a given customer. The problem for me now is that I create a customer object, pass it around the system for a bit, then decide that I need the address. Who ever it is that wants to know this must also have knowledge about where the data came from, i.e. know about the factory that produces the addresses for this customer. As the objects are to be passed from one system to another to another I'm not keen on this. I would prefer to pass all the information about in one chunk. I'm thinking that there isn't a nice simple solution to this problem and on my factory I'll end up with two methods, one listCustomers() which returns a collection of Value Objects containing customer id and name and one getCustomers() which returns the complete Big Value Objects. Is this the right approach? I would welcome any feedback from you guys out there, or any pointers to where this has been discussed in the past? thanks for your time in reading this, and in advance for any comments Regards IV ==================================================================== Getting Started: http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Community Web Site: http://java.sun.com List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to [EMAIL PROTECTED] =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
