1

I am doing a uml class diagram.

i have a class were i have variables and multiple constructors. are those to be included in the uml class diagram?

if yes,

is this good?

<<constructor>> Cells()
<<constructor>> Cells(int)?
cypherabe
  • 2,562
  • 1
  • 20
  • 35
Mark Bonello
  • 29
  • 1
  • 5

1 Answers1

1

It depends.

Sometimes, are not shown, sometimes, are shown as regular methods, and sometimes are explicitly displayed as special features.

Stereotypes and annotations are your friends.

..........................................................
..........................................................
......+----------------------------------------+---+......
......|........................................|...|......
......|..This is the default constructor.......+---*---+..
......|............................................|...|..
......+--------------------------------------------+...|..
.......................................................|..
.......................................................|..
..+-------------------------------------------------+..|..
..|...............<<..class..>>.....................|..|..
..|.................MyVideoGame.....................|..|..
..+-------------------------------------------------+..|..
..|..+....MyVideoGame( )...........<<constructor>>..*--+..
..|..+.... MyVideoGame (int this)..<<constructor>>..|.....
..+-------------------------------------------------+.....
..|..+....~MyVideoGame( )...........<<destructor>>..*--+..
..+-------------------------------------------------+..|..
.......................................................|..
.......................................................|..
.......+-----------------------------------------+-----+..
.......|.........................................|.....|..
.......|..This is the default destructor.........+-----*..
.......|...............................................|..
.......+-----------------------------------------------+..
..........................................................
..........................................................

Note that I use "c++" style of constructors and destructors, but apply also for another P.L.

U.M.L. gives you the flexibility to display your model, based in your project requirements.

Please, ignore the extra points, are used to format the diagram.

umlcat
  • 4,091
  • 3
  • 19
  • 29