Author Topic: Connecting classes to components  (Read 1177 times)

_GT_

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Connecting classes to components
« on: September 26, 2012, 09:14:56 pm »
What method would everyone recommend to show which classes are in which component?

Thanks in advance!

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Connecting classes to components
« Reply #1 on: September 26, 2012, 10:30:01 pm »
You might just specify them as composite parts of the component. Drag a class onto a component, select 'Composite Part' and fill in the part name appropriately.

HTH
GŁnther

_GT_

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Connecting classes to components
« Reply #2 on: September 27, 2012, 03:27:50 am »
Yes, we had thought of that. Other options are:
1. Use the relationship matrix to cross-reference them.
2. Create a traceability diagram and use trace relationships to link them
3. Use a shallow copy of the component diagram and overlay classes around the components.

Just wondered what method other people (or anyone at Sparx?) uses as there doesn't seem to be a standard way to document this information.

Previously we would have created subsystems from packages of classes (change the package stereotype to 'subsystem'), then create a corresponding component of the same name, but we are trying not to use subsystems as I believe they are not technically in the UML any more!

Any other thoughts or suggestions welcomed...

GT

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Connecting classes to components
« Reply #3 on: September 27, 2012, 07:17:01 pm »
Meanwhile I use additional packaging components to place my classes in there, the packaging component has a trace dependency to the 'original' component. I use it this way, because I can't model interfaces or ports with packaging components.
So I end up with a 'original' component exposing interfaces and/or ports, and containing other components or classes as parts/ports and the additional packaging component that contains the classes that directly belong to the original component. The packaging component can also serve as namespace root for code generation.

HTH
GŁnther
« Last Edit: September 27, 2012, 07:17:31 pm by Makulik »

philchudley

  • EA User
  • **
  • Posts: 533
  • Karma: +9/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
Re: Connecting classes to components
« Reply #4 on: September 27, 2012, 08:47:09 pm »
Make the component a composite
Change the diagram type to Class Diagram
Model the classes

Cheers

Phil
follow me on Twitter

@SparxEAGuru

_GT_

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Connecting classes to components
« Reply #5 on: September 28, 2012, 01:05:57 am »
Quote
Make the component a composite
Change the diagram type to Class Diagram
Model the classes

Cheers

Phil

Yes I would like to structure things this way, but for other reasons we need to keep the component elements in a Component Model View and the classes in a Logical view.

I know you can 'make composite', them move the diagram elsewhere, so maybe that's the way to go - a double click on the component will take us into the class diagram and the classes can still live in the Logical model view! Problem with that is that you also have to change the diagram type. All of which adds up to make the procedure very 'clunky'!

I guess it all depends on what output and searches you require on the EA model - I was simply trying to get a feel for how others show these connections as there doesn't seem to be a UML standard way of documenting this information.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8204
  • Karma: +193/-23
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connecting classes to components
« Reply #6 on: October 01, 2012, 07:43:46 pm »
I think in the UML the relationship you are looking for is

Component -> ComponentRealization -> Classifier

See UML Superstructure "Figure 8.2 - The metaclasses that define the basic Component construct"

I haven't tried to model this using EA.

Geert

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2498
  • Karma: +32/-2
    • View Profile
Re: Connecting classes to components
« Reply #7 on: October 02, 2012, 09:43:49 am »
Quote
I think in the UML the relationship you are looking for is

Component -> ComponentRealization -> Classifier

See UML Superstructure "Figure 8.2 - The metaclasses that define the basic Component construct"

I haven't tried to model this using EA.

Geert
Just use a plain Realization (EA doesn't yet serialize it as ComponentRealization, but it's on the list of things to do...)
The Sparx Team
support@sparxsystems.com