Book a Demo

Author Topic: Dependencys  (Read 11899 times)

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Dependencys
« on: September 14, 2005, 09:57:44 am »
Hello community,

today I have a question about dependencys.

Let's say we have the following scenario:

I have a class A which has a function func(param : C)

As I understand, this means, A has a dependency to C (because of param).

Now I derive a class B from A and overwrite the function func.

Now my question: should I show the dependency to C in the diagrams, or is it implicit?

If the answer is "yes, you should show the dependency". What happens if I don't overwirte func in B? Should I show the dependency in this case?

bye
Andreas


bye
Andreas

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Dependencys
« Reply #1 on: September 14, 2005, 11:45:24 am »
Are both A and B modeled on the same Diagram or are they modeled on different diagrams?

IMO, the dependency that A has on C is inherited when B specalizes A.

Quote
Now my question: should I show the dependency to C in the diagrams, or is it implicit?
Remember that a model is an abstraction of essential elements of interest from a real-world subject, and, that a model is a form of communication.  Thus, the answer to your question is "maybe", depends on how important it is to communicate B's dependency on C and what the probability is that your reader will get the implication.  There is no UML rule that I know of that requires either diagramming approach.  ;D
« Last Edit: September 14, 2005, 11:46:35 am by jeshaw2 »
Verbal Use Cases aren't worth the paper they are written upon.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Dependencys
« Reply #2 on: September 14, 2005, 07:27:54 pm »
Andreas,

Formally, B has a derived dependency on C.

Elsewhere I have stated my opinion that it would be good to have the modelling tool create these derived relationships and then leave it up to the modeller to display them or not on any arbitrary diagram.

As Jim says, the objective is to communicate.  If it's useful, show it - but differentiate it.  Otherwise, suppress it.

On my diagrams, derived relationships are marked with a pukey olive colour and have the "/" derivation marker shown in the appropriate names.  That way, they stand out.

HTH,
Paolo
« Last Edit: September 14, 2005, 07:28:20 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Dependencys
« Reply #3 on: September 14, 2005, 08:28:40 pm »
If by overwrite, you mean the child class implementation overrides the parent class method, then there is no reason why the child class parameter type should be inherited.  It may well be, but not necessarily.
e.g. Even iff Cow --|> Animal
Animal.Eat(fodder as food)
Cow.Eat(fodder as hay)

"hay" may or may not be a specialisation of "food", especially if "cow" overrides "Eat".  If hay is not a specialisation of food then an inherited dependency would be false.

Also, inherited dependencies could become very unwieldy if automatically created.  Consider the .NET collection class dependencies, which not only go back several levels, but could if inserted automatically inserted into models, create false impressions of circular dependencies.  Even worse would be the dependencies created by interface items.

"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Dependencys
« Reply #4 on: September 14, 2005, 10:15:49 pm »
Quote
[size=13][SNIP][/size]
Also, inherited dependencies could become very unwieldy if automatically created.  Consider the .NET collection class dependencies, which not only go back several levels, but could if inserted automatically inserted into models, create false impressions of circular dependencies.  Even worse would be the dependencies created by interface items.
bruce you are, of course, quite right.  Thinking back on what I said (I haven't searched) I think I actually said, that I'd like to pick two classifiers and ask the system to show me any actual/derived linkages.  Then you could pick the ones to show.  That way, the modeller would control the combinatorial explosion but with automated assistance. 8)

Any chance of this Sparx?

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

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Dependencys
« Reply #5 on: September 15, 2005, 12:10:12 am »
Quote
ask the system to show me any actual/derived linkages.  Then you could pick the ones to show.


Definitely, definitely, definitely  ;D ;D ;D

bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: Dependencys
« Reply #6 on: September 15, 2005, 12:23:21 am »
Thanks for all the answers till now,

I thougth, I asked a simple question, and now after 15 hours there are 5 answers.  :D

But here is my cognition after reading all your answers:
I think to show the dependeny when it's useful for the communication is the best solution.
And for sure, if the base class is visible on the same diagram, it's not necessary to show the dependency (becaue, if I inherit from a class, I inherit ALL, also the dependencies).

And It would be realy nice, if the application (in this case EA), would automaticly detect, if it's necessary to show the dependency or not.

Just for Information, why I was intrested in this question: I will combine some classes in components and now I have to find necessary interfaces. To find this Interfaces I need all dependencys between the components.

Thanks for all your answers till now.
bye
Andreas

thomaskilian

  • Guest
Re: Dependencys
« Reply #7 on: September 15, 2005, 12:36:11 am »
Spannende Sachen, die ihr da im Schwabenland macht :)

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
[Offtopic] Re: Dependencys
« Reply #8 on: September 15, 2005, 12:43:35 am »
Hi Thomas,

macht ihr in Berlin, nicht solche spannenden Sachen?  ;D

[glb]Congratulations to your 1600th posting!!!![/glb]
Keep at it!
bye
Andreas

thomaskilian

  • Guest
Re: Dependencys
« Reply #9 on: September 15, 2005, 01:04:46 am »
What a coincidence 8)

Unfortunately it's not so thrilling (for the past few months) :( So for my pastime I thought I'd post a bit in german since these Aussies started also a cryptic post I could not understand :'(

Have a nice time in Swabia :)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Dependencys
« Reply #10 on: September 15, 2005, 03:16:50 am »
Quote
So for my pastime I thought I'd post a bit in German since these Aussies started also a cryptic post I could not understand :'(
Let's be clear, the post is unlikely to have been started by an Aussie,  more likely a POM (Englishman)! ;D

If PhilB will identify his nationality, we can put this one away...
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

thomaskilian

  • Guest
Re: Dependencys
« Reply #11 on: September 15, 2005, 07:11:01 am »
c/Aussie/Commonwealth/ ::) (does Australia still belong to the British Crown??? - sorry for being ignorant)

Anyway, thanks for clarification :)

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Dependencys
« Reply #12 on: September 15, 2005, 04:08:35 pm »
Thomas,

Start herehttp://en.wikipedia.org/wiki/Australia_Act and follow the Statute of Westminster links.

I once found the original act that created the Commonwealth  of Australia - its includes the "state" of New Zealand and excludes Western Australia.

bruce

p.s. We are not whinging about the cricket.  Good luck to them!  However, all true Australian's have a natural desire to submit the English to periodic symbolic thrashings - its a heritage thang!
« Last Edit: September 15, 2005, 04:14:42 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.