Book a Demo

Author Topic: Class Instances On Object Diagrams  (Read 6378 times)

sbaldrick

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Class Instances On Object Diagrams
« on: September 03, 2011, 05:37:17 am »
What is the difference between a Class diagram and an Object diagram?

If I drop a class on a class diagram I see a representation of that class.

If I drop a class on an object diagram I see a representation of an instance of that class - surely? Nope, I see the same as the class diagram.   [smiley=bath.gif]




Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Class Instances On Object Diagrams
« Reply #1 on: September 05, 2011, 09:12:29 am »
When you drag and drop most element types from the Project Browser, you should typically have the options to paste as Simple Link, as an Instance, or as a Child.  By selecting to paste as an "Instance" it will create an Object instance referencing your Class as it's classifier.  This is what you'll want for your Object diagram.

See:
http://www.sparxsystems.com/enterprise_architect_user_guide/9.0/modeling_basics/pastingfromthetree.html

sbaldrick

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Class Instances On Object Diagrams
« Reply #2 on: September 10, 2011, 07:59:41 am »
Ah, I must have that option turned off, because i\I am not promted on drag and drop. To be honest, I am not going to turn it on, because that would mean way too many prompts.

I think that the original suggestion in the question is a good idea. Otherwise the object diagram is just a class diagram with a different default palette.

Leslie.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Class Instances On Object Diagrams
« Reply #3 on: September 15, 2011, 04:29:47 pm »
Leslie,

Ctrl+drag will show the dialog anyway.

In fact in EA all diagrams behave exactly the same, except for the sequence diagram.
So there is no difference at all between an object diagram, class diagram, ...
I like it that way. Other tools I've worked with did this differently and were fussy about the type of diagram.
That only lead to frustration as the tool didn't do what I wanted it to do :-X

EA is very free in that regard, and I think it should stay that way.

Geert

sbaldrick

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Class Instances On Object Diagrams
« Reply #4 on: September 16, 2011, 02:11:07 am »
Can we have it both ways .. an object diagram that is identical to the class diagram and an object diagram that manipulates instances of classes - perhaps it could be named the 'Leslie Object Diagram' type?

 ;)

Thanks for the info.

sbaldrick

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Class Instances On Object Diagrams
« Reply #5 on: September 16, 2011, 04:26:16 am »
I must be trying to reply with something bad, cos as I was about to post, my page redisplayed the comment field and my message got lost :( (silly me for not making a copy before trying to post).

Here goes again - related to another recent thread on inheritance as well as this:
- when one creates an object from an instance of a class, the object does not get the classes inherited information (incl. attributes). This is a problem because the object is now crippled.  [smiley=thumbdown.gif]
- when showing the properties of an object there is no access to its attributes or operations (the details tab is missing).
- object attributes and operations do not show in the project browser either.

+ When an objects attribute is changed, the change is inherited through the class to all object instances, which is great - BUT I wonder if making changes to a set of class instances should be restricted to the class instead of allowing an instance to change a classes properties.

(Ugh - did it again. Instead of copying the message I hit paste by mistake .. grrr. Don't type large mssages directly into the comment window .. there is no recovery method when you make a mistake.)

- As discussed, in order to find inherited properties of a class, one must drag the class onto a diagram and use the diagram to display inherited properties. You bring up the pop-up menu on the class and select the option to show its inherited attributes. Now that you can see that the class has inherited properties, you must locate the class that it is inheriting from. To do this show the class relationships and look for generalizations entering the class. Follow the relationship back to the supertype class and open its properties to get access to the subtype class inherited properties (I'll draw a UML model to explain .. without objects or inheritance).

- BTW, inheritance includes class relationships too. So when I select a class I should see its inherited relationships in the relationship viewer. I don't.

Anyway, all this leads me to conclude that maybe (just possibly), EA does not really support inheritance of classes at all, and that all the tool is doing is allowing one to see where one would like to use inheritance (ok, I take that back, before anyone sues).

I wanted to post a diagram of a class on a diagram (showing inherited attributes) and its properties showing no inherited attributes (honest it looks really confusing), but can't find an easy way to do, so you'll have to take my word that it does look really confusing.