470,848 Members | 963 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

Java design issue: Preparing for future extensions/versions...

"Program to Interfaces, not Implementations" we've all heard, however I
now identified a scenario where this idiom can not be used (I think) and
is searching for another approach.

I have a method exposed as a webservice (JAX-RPC) which specifies that
the pass/return types must adhere to primitive types, beans and/or arrys
of these.

My application is supplying an argument in the form of an ArchiveItem
instance when calling the webservice:

// Argument bean
class BookItem
{
String Title;
String Publisher;
}

// Calling webservice
...lookup( ArchiveItem );

However, what if I wanted to plan ahead, knowing that probably soon I
will have to add another customer who wish to search by another field,
say Author. At the same time, I wish to let the existing customers use
their existing code and call the now "deprecated versions". By
implementation enheritance I could:

// Argument bean
class BookItemAdvanced extends BookItem
{
String Author;
}

// Calling webservice
lookup( ArchiveItemAdvanced );

This would solve the problem, but it requires implementing a new
(overloaded) webservice and introducing a potentially large versioned
hiarachy (Next extension would be BookItemSuperAdvanced...).

Is there a smarter way from a design perspective that does not simply
pass an interface; I am unable to pass/return interfaces over
WebServices pressumely because of serializabilty issues.

Thanks in advance,
Casper
Jul 18 '05 #1
0 2094

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris Morgan | last post: by
8 posts views Thread by Wookie | last post: by
9 posts views Thread by IchBin | last post: by
reply views Thread by YellowFin Announcements | last post: by
15 posts views Thread by himilecyclist | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.