Book a Demo

Author Topic: Dependencies from operations to classes  (Read 2724 times)

olafk

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Dependencies from operations to classes
« on: June 07, 2006, 03:33:56 am »
Hi all.

I have a need to model dependencies from (class) operations to other classes. Say, for example, an operation on a class might throw exceptions of sorts and thus is dependent on the exception classes. I would want to explicit represent this dependency in the model...

Is there any way to establish such dependency associations from operations? (Even better if they'd then be treated like any old dependency: stereotypes, etc.)

cheers,
-olaf

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Dependencies from operations to classes
« Reply #1 on: June 07, 2006, 04:48:59 am »
Quote
Hi all.

I have a need to model dependencies from (class) operations to other classes. Say, for example, an operation on a class might throw exceptions of sorts and thus is dependent on the exception classes. I would want to explicit represent this dependency in the model...

Is there any way to establish such dependency associations from operations? (Even better if they'd then be treated like any old dependency: stereotypes, etc.)

cheers,
-olaf
Hi Olaf,

UML doesn't (directly) allow relationships from Features (such as Operations and Attributes) to Classes.

That having been said, relationships can be implied:  For example, a named navigable Association is defined as an Attribute.  Thus for your purposes, you could use a similar idea.

If you draw the dependency from the Class with the Operation to the Class referenced by the Operation, and name the target role the name of the operation, you are effectively creating the type of dependency you are requiring.

Unfortunately, you need to do this manually.

Does that help?
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Dependencies from operations to classes
« Reply #2 on: June 07, 2006, 05:24:52 am »
Could you model these as a <<uses>> (perhaps it is <<use>> in UML 2.0) relationship between the two classes?
No, you can't have it!

olafk

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Dependencies from operations to classes
« Reply #3 on: June 08, 2006, 06:45:01 pm »
Thanks guys, indeed quite helpful. More than anything, it gets the creative mind going... Something I didn't quite mention is that I am feeding the (exported) model into the AndroMDA generator tool... so there's a few other issues to consider.

What I ended up doing is taking up Paolo's idea, but I am also adding a stereotype of <<Throws>> to the dependency (which is picked up in AndroMDA).

In short, both suggestions most welcome...

cheers,
-olaf