• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Multiple versions of a component - design question

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Have a question about a problem and its solution.

There is an application which uses a component (say a tax calculator - taxcalc.jar). The requirement is that the application should be able to use multiple versions of the component based on some runtime value. This means that the multiple versions of taxcalc classes should coexist in the same JVM at the same time and the application could use, for example, classes from version 1.1 for one user and version 1.3 for another user.

I could think one way to do this:

Design the classes in the component to have a version as part of the package name. The application could use the runtime value to create the package name (and fully qualified class name String), use the reflection to instantiate the correct version of the class and then proceed using the instance.

Wish some designers/architects here could review this. Are there any other/better solutions?

Thanks in advance,

-Milind
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should look into OSGi.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Milind Mahajan wrote:
There is an application which uses a component (say a tax calculator - taxcalc.jar). The requirement is that the application should be able to use multiple versions of the component based on some runtime value. This means that the multiple versions of taxcalc classes should coexist in the same JVM at the same time and the application could use, for example, classes from version 1.1 for one user and version 1.3 for another user.



That is not a requirement, that is a technical implementation.

What do your customers actually want *to do*?
 
Milind Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response.

May be I mixed my technical thoughts with the requirement that I got. This is the requirement -> The customer wants the application to be able to use different versions of the tax calculator based on some configuration/user specific value.

What are your comments on the solution?

-Milind
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And why does he want to be able to do that? Where's the business value?
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ilja Preuss wrote:And why does he want to be able to do that? Where's the business value?


Actually, this is more technical than business.

For example, if we have a server application that supports some kind of client and after that we update server code to support a new version of client, and we'll retire support for the old client eventually but not immediately. How do we do?

We can build a big jar that supports both versions of client or we can have 2 jars, client1.0.jar and client2.0.jar, and load a library dynamically based on a request. If we do the latter, when we want to retire support for client 1.0, we just remove it, and change code to load only client2.0.jar, in case that a request come from client 1.0, reply message "Please update your client to version 2.0".

If there are just 2 versions, it might still be manageable to have a big jar, but what if we have 3, 4, or 5 versions, and we have plan to retire version 1, 2, 3, 4?
 
Milind Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kengkaj.

Yes. It is a technical requirement.

Any comments on the solution I outlined? Or any other?

-Milind
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can check OSGi. I don't know the detail, but it supports versioning.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What a good solution will look like depends a lot on what the actual reason behind the request is. So I really feel I can't give a good recommendation before you tell us the business requirement behind the technical requirement.
 
Milind Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wish I could add more to the requirement that I stated earlier. But all I got was the technical requirement.

Anyway, thanks both of you for the responses.

-Milind
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it is supposed to be different function limitation, the accessable function depends on the configurations.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic