Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: Help me with Components and package reuse
Topic Summary: Need assistance with package reuse
Created On: 20-Jan-2009 20:02
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 20-Jan-2009 20:02
User is offline View Users Profile Print this message


Paul Coene

Posts: 8
Joined: 7-May-2008

This seems like a simple topic, but I find that after trying a few times to explain my plight, I don't like my own explanations. Regardless, I'll try again.

For good or bad, the following is how my project is organized:

I have several packages of classes.

Each package has a container class called packagename_subsystem. Within the packages everything is events and statemodels. Outside, the package looks like a functional subsystem, its API exported via the container class.

I have one large OMD that associates the containers to one another based on usage.

So, if lets say my package that handles calculations wants to talk to the GUI, it does so via the GUI package as such:

itsGUI_Subsystem->functionname(xyz).

This has served me well.

Now, I am looking to make a new component, that uses all of the packages but one. So I add a new component, and uncheck the unwanted package. I like the package API, so I copy the old package to a new name and include the new one.

I want to edit the guts of the new package and just build and go.

I don't want to change my old packages, as I still need to build that other component from time to time for maintenance and want to use the same code.

However, the OMD diagrams know that my other packages want that old package specifically. Even if my new package has the same class names, the other packages "know" about the old package name and refuse to work.

I basically had:

an old package X with a class within it called Y.
a new package called Z with the same class Y (modified)

I want to be able to make

- one component that uses all my stuff + X/Y (my existing build)
- one component that uses all my stuff + Z/Y (new new build)

Basically, I am replicating a package and want to pick the original one or the new one in the component/scope.

How can I do this, when inter-package associations keep the package name?

I know I could just copy the whole project and do what I want, but I'd like to maintain both components with common code.
Report this to a Moderator Report this to a Moderator
 21-Jan-2009 09:48
User is offline View Users Profile Print this message


Simon Morrish

Posts: 127
Joined: 17-May-2005

Hi Paul

That's a very clear description. Thankyou. The problem you're describing is fairly common, and it's what Object-Oriented programmers call "polymorphism". In other words, you want AllYourStuff to be able to talk to any one of a number of components having a common API. Let's call the API "YInterface".

My assumptions:
  1. I'm assuming you're using RiCpp. I'm not sure how well this works in RiC...
  2. You mention an OMD that relates container classes to each other, then later refer to OMDs knowing about packages. I'm assuming the former is correct - that the OMD shows container classes linked together, and the inter-package dependencies are a result of this.

So, one way to solve your problem is:
  1. Create a new class called YInterface
  2. Stereotype it as "Interface"
  3. Create all the operations for your "Y" API on this class, but specify them all as "Abstract".
  4. Change your OMD to refer to YInterface rather than either of your "Y" classes.
  5. To each of your existing Y classes (let's call them Yx and Yz), add a new SuperClass of YInterface.
  6. Change the code/model that initialises your components so that one component creates a runtime link between itsAllYourStuff and itsYx, and the other creates a link between itsAllYourStuff and itsYz.


Before I go on (I could create a demo model, if that would help) I want to check in with you:
  • Does what I've written make any sense to you?
  • What edition and version of Rhapsody are you using?


best regards,
Simon

-------------------------
Simon Morrish
simon.morrish@eu.panasonic.com
http://panasonic.co.uk
Panasonic ideas for life

Edited: 21-Jan-2009 at 09:50 by Simon Morrish
Report this to a Moderator Report this to a Moderator
 21-Jan-2009 19:36
User is offline View Users Profile Print this message


Paul Coene

Posts: 8
Joined: 7-May-2008

Thanks. That is very clear. I may try that our in a week or two. In the meantime I actually found a different, but less useful (long term) solution. All of my interface classes were all inside one container class. I utilized the container's pointer to the class I wanted and got rid of the inter-interface class relationship. This worked for now, but I think I will try what you said when I move forward.

I'm running 7.1, CPP.

Thanks
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.