Book a Demo

Author Topic: Model elements organization: packages?  (Read 3242 times)

EugeneZ

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Model elements organization: packages?
« on: August 30, 2005, 02:30:47 am »
Hallo, dear audience!

I have a question about organizing my classes in my model. Physically I have a library with a lot of c++ classes. All the classes in that library find themselves in one c++ namespace. But in my UML model I want to subdivide that classes into thematic subfolders, so that they are grouped together by features that thay expose. If I use packages for this reason, I became two problems:
1) package is understood as a namespace and I do not need it. I need just a organizational folder.
2) if I use code engineering for my model, than each of packages is generated as folder in the file system. And I do not need this too.

I give some example, trying to clarify this:
I have some package P and 100 classes (C1-C100) in it. So, class qualifiers are P::C1-P::C100. In my UML model in package P I want to have subfolders to organize my classes into folders F1-F10, 10 classes in each one. F.i. Classes C1-C10 into F1. BUT. I need, that class qulifiers are still understood as P::C1 but not as F1::C1. And code generation does not produce F1 folder on file system.

What should I do? If it possible, which element should I use?

Thanks a lot!

davisford

  • EA User
  • **
  • Posts: 63
  • Karma: +0/-0
    • View Profile
Re: Model elements organization: packages?
« Reply #1 on: August 30, 2005, 11:33:18 am »
Look in Help under:

Code Engineering -> Generate Source Code -> Namespaces

If you right-click a package: Package Control -> Set As Namespace Root.

EugeneZ

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Model elements organization: packages?
« Reply #2 on: August 31, 2005, 03:01:49 am »
Hallo!

Yes, this should solve problem with root namespace, but not with all of the nested namespaces. And if I would check off "generate namespaces", there still a problem with folder structure on the file system.

It seems, that there is no other solutions exept two:
1) organize the whole model corresponding to code generation rules or
2) have 2 views: one analitical and second for code generation.

Other solutions?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Model elements organization: packages?
« Reply #3 on: August 31, 2005, 03:41:52 pm »
I would say that the easiest thing to do would be to keep them all physically in the one package, then create diagrams, to show the features they expose.

Alternatively, if you really want seperate packages I see two options.

1. Create packages F1-F10, set them all as namespace roots, and create a package C1 under each of them.

2. Create your packages as you want, give your packages F1-F10 a stereotype and create a transformation template that copies the model exactly except for skipping over the stereotyped packages.

Simon

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Model elements organization: packages?
« Reply #4 on: August 31, 2005, 07:05:56 pm »
Eugene,

One problem that you have is that in UML a Package IS a Namespace.

So how could you define a package that isn't a namespace?  Well, you could create a non-sense...
For example an "abstract" package!

I don't know if this will work for you, but in my EA Emitter process (which emits the EA model in my bespoke XML interface), setting the IsAbstract checkbox on the package specifically tells the XML interface that this package is for grouping only and not to generate a namespace for it.

Thus if I have a structure:

Package Q
   {abstract} Package R
       Package S
            Class t

the interface tells you that Class t is in namespace Q.S.

You may be able to alter the CGT to take note of the IsAbstract boolean, in  the same way as me.

If you think this is a good approach, you might like to formally report it to the Sparx support email address: [email protected].

HTH,
Paolo
« Last Edit: August 31, 2005, 07:08:49 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

EugeneZ

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Model elements organization: packages?
« Reply #5 on: September 02, 2005, 07:51:05 am »
I very appreciate your answers, Simonm and Paolo! Thanks!

We are not to genereate a code from our analitical model now, but your solution, Paolo, seems to be very good. If we'll test your approach in praxis, we'll fullfill yours appeal and report it by Sparx.

See you!

Best regards,
    Eugene.