Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Sequence Diagram to Java Code ATL Transformations
Re: Sequence Diagram to Java Code ATL Transformations [message #477684] Fri, 15 August 2008 14:59 Go to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 32454
Registered: July 2009
Senior Member
Hugo,

I think answers to your questions rely on understanding what a sequence
diagram means, so I'll be of little help in that regard. More likely
someone with UML knowledge can help, so I've added the UML2 newsgroup to
the "to" list of the reply.


Hugo Marques wrote:
> Hello,
>
> I am currently developing a tool for generating Java code from UML
> sequence diagrams. In this context, I have two doubts and should be
> grateful if someone could help me.
>
> Doubts:
>
> 1 - Concerning the instantiation of the objects represented by the
> lifelines, these objects should be translated a) as attributes from
> other objects
> class {
> private LifelineObject1 l1;
> private LifelineObject1 l2;
>
> }
>
>
> b) as parameters taken in the method generated to the sequence diagram?
> returnType method(LifelineObject1 l1, LifelineObject2 l2) { ... }
>
> 2- Concerning control flow of the method. For example, consider a
> sequence diagrama named test that has three lifelines ( l1, l2 and
> l3), where l1 sends a message msg1() to l2 that in turn sends a
> message msg2() to l3. Which would be the correct translation (see the
> options below) from this flow to the java code?
>
> a) All messages in the same method but from different classes.
> class l1 {
> test() {
> l2.msg1();
> l3.msg2():
> }
> }
>
> b) All messages in the same method and class.
>
> class l1 {
> test() {
> self.msg1();
> self.msg2();
> }
> }
>
>
> c) Messages from different classes and differente methods.
> class l1 {
> test() {
> l2.msg1();
> }
> }
>
> class l2 {
> msg1() {
> l3.msg2();
> }
> }
> Thanks in advance for any help,
>
>
> Best regards,
> Hugo Marques
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Sequence Diagram to Java Code ATL Transformations [message #477685 is a reply to message #477684] Mon, 18 August 2008 14:28 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Hugo,

To be honest, in regards to your first point below, I'm not sure what the
question is ?

In regards to point 2, there is not enough information to respond, since one
would have to know what ConnectableElement the lifeline represents, its type
etc. In addition, there could be many different valid interpretations.


In general, supporting code generation from all the constructs concerning
UML sequence diagrams would be difficult (if not impossible) in my humble
opinion.

One particular sequence diagrams shows a valid trace of execution, it
doesn't mean that other traces are invalid. If you consider asynchronous
messages or control flow mechanisms, as you point out in your second point
below, then there could be several correct implementations that produce the
same trace. In addition, for any given implementation, there may be
multiple valid sequences.

In general, sequence diagrams puposely omit information in order to
succinctly communicate the intended flow of events (ie. used as a sketch).
If you had a complete sequence diagram of an acutual running system then it
would be so visually cluttered that it would be very difficult to read.
Sequence diagrams can either show traces for particular instances (in which
case the represented connectable element would be shown with an underline)
or any general instance.

HTH

- James.



"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:g845ko$26e$1@build.eclipse.org...
> Hugo,
>
> I think answers to your questions rely on understanding what a sequence
> diagram means, so I'll be of little help in that regard. More likely
> someone with UML knowledge can help, so I've added the UML2 newsgroup to
> the "to" list of the reply.
>
>
> Hugo Marques wrote:
>> Hello,
>>
>> I am currently developing a tool for generating Java code from UML
>> sequence diagrams. In this context, I have two doubts and should be
>> grateful if someone could help me.
>>
>> Doubts:
>>
>> 1 - Concerning the instantiation of the objects represented by the
>> lifelines, these objects should be translated a) as attributes from other
>> objects
>> class {
>> private LifelineObject1 l1;
>> private LifelineObject1 l2;
>>
>> }
>>
>>
>> b) as parameters taken in the method generated to the sequence diagram?
>> returnType method(LifelineObject1 l1, LifelineObject2 l2) { ... }
>>
>> 2- Concerning control flow of the method. For example, consider a
>> sequence diagrama named test that has three lifelines ( l1, l2 and l3),
>> where l1 sends a message msg1() to l2 that in turn sends a message msg2()
>> to l3. Which would be the correct translation (see the options below)
>> from this flow to the java code?
>>
>> a) All messages in the same method but from different classes.
>> class l1 {
>> test() {
>> l2.msg1();
>> l3.msg2():
>> }
>> }
>>
>> b) All messages in the same method and class.
>>
>> class l1 {
>> test() {
>> self.msg1();
>> self.msg2();
>> }
>> }
>>
>>
>> c) Messages from different classes and differente methods.
>> class l1 {
>> test() {
>> l2.msg1();
>> }
>> }
>>
>> class l2 {
>> msg1() {
>> l3.msg2();
>> }
>> }
>> Thanks in advance for any help,
>>
>>
>> Best regards,
>> Hugo Marques
>>
Re: Sequence Diagram to Java Code ATL Transformations [message #626877 is a reply to message #477684] Mon, 18 August 2008 14:28 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Hugo,

To be honest, in regards to your first point below, I'm not sure what the
question is ?

In regards to point 2, there is not enough information to respond, since one
would have to know what ConnectableElement the lifeline represents, its type
etc. In addition, there could be many different valid interpretations.


In general, supporting code generation from all the constructs concerning
UML sequence diagrams would be difficult (if not impossible) in my humble
opinion.

One particular sequence diagrams shows a valid trace of execution, it
doesn't mean that other traces are invalid. If you consider asynchronous
messages or control flow mechanisms, as you point out in your second point
below, then there could be several correct implementations that produce the
same trace. In addition, for any given implementation, there may be
multiple valid sequences.

In general, sequence diagrams puposely omit information in order to
succinctly communicate the intended flow of events (ie. used as a sketch).
If you had a complete sequence diagram of an acutual running system then it
would be so visually cluttered that it would be very difficult to read.
Sequence diagrams can either show traces for particular instances (in which
case the represented connectable element would be shown with an underline)
or any general instance.

HTH

- James.



"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:g845ko$26e$1@build.eclipse.org...
> Hugo,
>
> I think answers to your questions rely on understanding what a sequence
> diagram means, so I'll be of little help in that regard. More likely
> someone with UML knowledge can help, so I've added the UML2 newsgroup to
> the "to" list of the reply.
>
>
> Hugo Marques wrote:
>> Hello,
>>
>> I am currently developing a tool for generating Java code from UML
>> sequence diagrams. In this context, I have two doubts and should be
>> grateful if someone could help me.
>>
>> Doubts:
>>
>> 1 - Concerning the instantiation of the objects represented by the
>> lifelines, these objects should be translated a) as attributes from other
>> objects
>> class {
>> private LifelineObject1 l1;
>> private LifelineObject1 l2;
>>
>> }
>>
>>
>> b) as parameters taken in the method generated to the sequence diagram?
>> returnType method(LifelineObject1 l1, LifelineObject2 l2) { ... }
>>
>> 2- Concerning control flow of the method. For example, consider a
>> sequence diagrama named test that has three lifelines ( l1, l2 and l3),
>> where l1 sends a message msg1() to l2 that in turn sends a message msg2()
>> to l3. Which would be the correct translation (see the options below)
>> from this flow to the java code?
>>
>> a) All messages in the same method but from different classes.
>> class l1 {
>> test() {
>> l2.msg1();
>> l3.msg2():
>> }
>> }
>>
>> b) All messages in the same method and class.
>>
>> class l1 {
>> test() {
>> self.msg1();
>> self.msg2();
>> }
>> }
>>
>>
>> c) Messages from different classes and differente methods.
>> class l1 {
>> test() {
>> l2.msg1();
>> }
>> }
>>
>> class l2 {
>> msg1() {
>> l3.msg2();
>> }
>> }
>> Thanks in advance for any help,
>>
>>
>> Best regards,
>> Hugo Marques
>>
Previous Topic:Re: Sequence Diagram to Java Code ATL Transformations
Next Topic:[Announce] MDT UML2 2.2.1 M200808191602 is available
Goto Forum:
  


Current Time: Sat Aug 20 02:50:29 GMT 2022

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

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

Back to the top