Re: How to describe array elements with UML2.0?



Responding to Allen...

For example

class Foo
{
public:
int a[3];

};

I write as following
+a : int[3]

But the generated code is much different.
class Foo
{
public:
Vector<int> a;

};

Actually, I think it is doing exactly what you want. I assume Vector is
a library array class provided by the tool vendor that is based on a
template like STL. The problem is that the tool has chosen to use a
very generic class that can contain an arbitrary number of elements.
Vector probably has an internal count of the actual number of elements
and an interface like Vector.getCurrentCount(). IOW, your code
generator is not doing a whole lot of optimization. B-)

<aside>
This sounds like your code generator is just a round-trip tool (headers
and body stubs) rather than a translation tool (full code generation).
Such tools work very close to the 3GL level and often employ an OOPL as
an action language. In the MDA profile for UML that most translation
tools use one cannot specify an attribute as "+a : int[3]". In such a
profile a knowledge attribute must be specified as a scalar ADT (e.g.,
"+a : VoltageList"). The mapping of that ADT to a more complex data
structure like an integer array is provided externally though a Marking
Model. That decouples the OOA view from specific storage
implementations like "int" and array structure.
</aside>


*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
info@xxxxxxxxxxxxxxxxx for your copy.
Pathfinder is hiring:
http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH



.



Relevant Pages