Book a Demo

Author Topic: "Return Array" check-box  (Read 6401 times)

jonniesavell

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
"Return Array" check-box
« on: February 01, 2007, 06:07:14 pm »
EA/UML Newbie here.

I would like to know how to model a collection as the return type of an operation.

I am curious about the meaning of "Return Array" check-box in the Operations properties for a class/interface.

Question: Does checking this check-box mean that the actual return type is some sort of collection of the type specified in field "Return Type"?

Concern:
When I check this check-box, the class diagram shows what appears to be Array notation rather than the multiplicity thing that I would really like.

Thanks in advance to any who have made it this far.

Sincerely,
Jon Savell

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: "Return Array" check-box
« Reply #1 on: February 01, 2007, 07:17:07 pm »
Hi Jon,

You (generally) don't have to post in more than one forum.

If you haven't got a reply, then it's probable we users can't help you and the Sparxians are too busy at the time.

As you've seen it's a pretty lively and responsive forum!

However, I would suggest that the checkbox specifically means you will get back an array of the Return type.  If you want to return a more structured type with ordering and multiplicity constraints, you return a suitably configured collection class instance.

It would appear that EA is lacking full support for the Semantic variations shown in 7.3.36 Operation (from Kernel, Interfaces) in the [size=13]UML 2.1 Superstructure (interim)[/size] Specification.

You should submit a bug report referencing this Topic, you can use Support link at the top of the page...

HTH,
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: "Return Array" check-box
« Reply #2 on: February 02, 2007, 05:21:17 am »
Or a feature request, as the case might be...
No, you can't have it!

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: "Return Array" check-box
« Reply #3 on: February 02, 2007, 05:31:34 am »
The referenced UML 2.1 Specification, section 7.3.36, seems to me to be self contradictory.

Under Constraints it says:  
Quote
[1] An operation can have at most one return parameter (i.e., an owned parameter with the direction set to ‘return’).
ownedParameter->select(par | par.direction = #return)->size() <= 1


Then under Notation it says:
Quote
• ordered means that the values of the return parameter are ordered.
• unique means that the values returned by the parameter have no duplicates.


I don't know how one can talk (meaningfully) about uniqueness and ordering of a single return parameter.  I can only reason that UML's implicit intent is to specify, on an operation that returns a multiplicity of elements, that the single parameter returned is a reference to a set of either the elements themselves, or secondary references to them.  Otherwise, I cannot resolve the contradiction.

The UML is silent on how all of this is implemented in code; e.g.; array, collection, list, object, etc.  That would be platform specific.  In a [PIM], I would define a class to hold the set elements and then return an object of that type.  Then, in the [PSM], that class may be sub-typed to take advantage of the implementation language used.

I don't see how the Semantic Variations section enters into this issue.  But I too, am confused by the Return Array name on the check box.  Perhaps EA can improve upon the name they chose?  Array is too data structure specific for my tastes.  What if the operation returns a reference to the head of a linked list or the root of a tree?  Perhaps Returns Set or Returns multiplicity?
Verbal Use Cases aren't worth the paper they are written upon.

jonniesavell

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: "Return Array" check-box
« Reply #4 on: February 02, 2007, 01:19:25 pm »
Given what I have read on the board, "Return Array" is definitely something I'd like to avoid.

Paolo suggests that I return a suitably configured collection class instance.

I also like Jim's suggestion of "Returns multiplicity" functionality.

I am trying to do my homework, but I would appreciate it if someone could help me get started on either of these approaches (even if it's a pointer to documentation).

Although I am currently importing Java specific types via packages, I would love to eventually use UML types exclusively.

Thank you all.

Sincerely,
Jon Savell