Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Generalization problem(I cant make a generalization set ot three objects)
Generalization problem [message #1782031] Fri, 16 February 2018 09:48 Go to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 48
Registered: December 2017
Member
Hello, i need to design a UML class diagram, with one object as parent ( payment class with quantity, id, date) and three diferent "sons" ( credit card with own attributes number of card, and expire date, a paypal method which i need the paypal account, and cash method).
So i need a generalization set of the three sons, and mark as disjoint, complete.

Ive been googleing and make lots of test but i can get whith it...any idea, link or step by step instructions would be nice.

In case that papyrus doesnt support this, i make the suggestion as is very usual to have three or 4 sons of a parent class using inheritnace in Java ( generalization in UML).

Re: Generalization problem [message #1782037 is a reply to message #1782031] Fri, 16 February 2018 11:41 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

A GeneralizationSet is an advanced UML concept that is too complicated for me to understand or want too use.

Your example seems to be the plain ordinary usage of Generalizations. Just define your 'sons' as having the 'parent' as their superClass. Draw a Generalization link from 'son' to 'parent'.

Regards

Ed Willink
Re: Generalization problem [message #1782067 is a reply to message #1782031] Fri, 16 February 2018 17:44 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Well, yes it is possible ;-)

index.php/fa/32113/0/
Re: Generalization problem [message #1782070 is a reply to message #1782037] Fri, 16 February 2018 17:47 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi Ed,
I really, really appreciate your humour.
/Carsten
Re: Generalization problem [message #1782072 is a reply to message #1782031] Fri, 16 February 2018 18:21 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi Eduardo,

sorry I overread you asked for step by step instruction.

OK, here it is:

Accordung to the OMG UML 2.5.x specification chapter 9.9.8 "GeneralizationSet [Class]" subclause 5 a GeneralizationSet owns Generalization associations as assciation ends. As Papyrus strictly adheres to the OMG UML 2.5.x specification this gives you a hint how to specify a GeneralizationSet.

As a GeneralizationSet refers to Generalization associations, you simply pick the Generalization associations out of the palette and draw a virtual line starting at the first Generalization association and ends at the second Generalization association.

This results in

index.php/fa/32114/0/

To add further Generalization associations to the GeneralizationSet is a little more tricky.

index.php/fa/32116/0/

As you see in the screen shot above a GeneralizationSet has a properties view, the properties view itself has an "Advanced" tab. Wtithin the advanced tab a attribute "Generalization Set" exists. At the right side end of the "Generalization Set" attribute line you'll see three dots, click on these three dots to select the GeneralizationSet the Generalization should be added to.

That's all.

/pica
Re: Generalization problem [message #1782102 is a reply to message #1782037] Sat, 17 February 2018 16:30 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi Ed,

I interpret

index.php/fa/32119/0/

that way.

1. The GeneralizationSet is incomplete, it does not meet the Liskov criteria.

2. The GeneralizationSet is disjoint, an instance of the classes within the GeneralizationSet may not be also an instance of another class within by the GeneralizationSet (e.g. an instance of MeansOfTransportation may not be a Bicycle and also a Plane)

Well, a sane model shall ensure
1. the Liskov criteria is always met
2. classes are disjoint

As a result I regard the GeneralizationSet as a means to indicate technical debt ;-)

/pica

[Updated on: Sat, 17 February 2018 16:32]

Report message to a moderator

Re: Generalization problem [message #1782128 is a reply to message #1782031] Mon, 19 February 2018 10:30 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 48
Registered: December 2017
Member
Thanks for your help.


Im interested in payment methods are disjoint and complete ( for example credit card, paypal, or cash).


After touching and some try and error... I have made a similar case. Using employees ( empleats) from a company. So the company has different kinds or classification ( sales employees, computer employees, marketing employees....). So i set manually the GeneralizationSet as a three-member set which the same name ( GeneralizationSetEmpleat). And three childs: EmpleatOficina, EmpleatMagatzem and EmpleatVendes. I think its ok.... as /Carsten suggested using the advanced tab in a GeneralizationSet ....


index.php/fa/32129/0/

[Updated on: Mon, 19 February 2018 10:38]

Report message to a moderator

Re: Generalization problem [message #1782131 is a reply to message #1782128] Mon, 19 February 2018 10:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Apologies if I miss your point but you seem to be using a complex construct to support the simple usage.

If PaymentMethod is an abstract Class with CreditCard, Paypal, and Cash as concrete derivations, the derivations are disjoint (different classes) and complete (you cannot instantiate the abstract class commonality).

Regards

Ed Willink


Re: Generalization problem [message #1782134 is a reply to message #1782131] Mon, 19 February 2018 11:10 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 48
Registered: December 2017
Member
Thanks for your help.

No paymentmethod would be a parent classe with common attributes: as quantity, date of payment an some observations. It would be associated with one Order.
Every paymentmethod would inheritate the common atributes and add some specific ones ( ex: in credit card payment the number of credit card, the expire date and cvs code, in the case of paypal the name of the account ....).
Re: Generalization problem [message #1782135 is a reply to message #1782134] Mon, 19 February 2018 11:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Why "no"? Surely yes? you put the common attributes in the common abstract class and the unique attributes in the derived classes possibly supported by polymorphic operation overrides.

Regards

Ed Willink
Re: Generalization problem [message #1782139 is a reply to message #1782135] Mon, 19 February 2018 11:53 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 48
Registered: December 2017
Member
Well i think that comon getDate,getQuantity and getObservations should not be written in every sub class as an abstract class.

But i suppose both points of view are correct. I was asking once i have made possible a GeneralizationSet of more than two elements, if its made the right way.... First i didnt know if i could make it in Papyrus, and with your help i think i did it. Not sure 100% if its correct.

Thanks again
Re: Generalization problem [message #1782142 is a reply to message #1782139] Mon, 19 February 2018 12:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

"every sub class as an abstract class". Sorry I'm lost. Maybe it's just your English. Maybe someone else can help one of us.

Regards

Ed Willink
Re: Generalization problem [message #1782188 is a reply to message #1782142] Tue, 20 February 2018 10:12 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 48
Registered: December 2017
Member
Well not important as i said before both points of view can be correct. I was trying to explain that in abstract class ( as i know so far) you have a virtual method, that has to be written in every sub-class ( child class). So you would need to write getters and setters in every subclass ( not in the parent class). I think this is not necessary as you can write getters and setters in the parent class, and then by inheritance the child class would have access to them. Sorry for my bad english...
Re: Generalization problem [message #1782190 is a reply to message #1782139] Tue, 20 February 2018 10:29 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi Eduardo,
Hi Ed,

I guess Eduardo simply mixed up the terms class and operation. Neither class or operation in the diagram Eduardo attached seems to be marked abstract as no name is rendered in italics.

I personally would mark the parent class Empleats abstract, simply to ensure it nevers gets instanciated.

/Carsten
Re: Generalization problem [message #1782205 is a reply to message #1782188] Tue, 20 February 2018 12:22 Go to previous message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi Eduardo,

UML allows abstract classes to own non-abstract operations. And at least Java and C#/.NET also support this.

/pica
Previous Topic:Installation papyrus doubt
Next Topic:Installation help needed on Mars
Goto Forum:
  


Current Time: Fri Apr 19 22:43:55 GMT 2024

Powered by FUDForum. Page generated in 0.04974 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top