that were shone when I got tempered!

Class Diagrams – Representing classes

leave a comment »

A Class diagram is made up with a set of classes and the relationship between them

Representation of a Classes in a class diagram.

Class is represented by a Box with separate partitions

  • Class Name : This is in the first partition.Screenshot from 2014-02-20 15:47:04
  • Instance Variables : This is in the second partition. Variable type is shown after the colon.
  • Methods : This is in the third partition. Method’s return type is provided after the colon at the end of the method signature. Argument type is provided after the colon at the end of the argument name. Method directionality is mentioned as in/out and inout. A reference to some class is denoted by an asterix (*).

If a class variable or a method is a static it must be underlined. And if Class or a method is abstract it should be italic.

In the picture, we can observe the following for MyClassName

  • MyClassName has 3 attributes and 3 operations
  • op2 returns a float
  • Parameter p3 of op2 is of type int
  • op3 returns a pointer (denoted by a *) to Class6

Visibility and Access for the variables and methods of the class diagram

Access levels are denoted by +, – and # signs preceded to the variable and method names.

  1. + denotes public attributes or operations
  2. – denotes private attributes or operations
  3. # denotes protected attributes or operations

Method parameter directionality

Screenshot from 2014-02-20 16:01:52

Each parameter in an operation (method) may be denoted as in, out or in/out which specifies its direction with respect to the caller. This directionality is shown before the parameter name.

Check this sample for more info.

References :


Written by Namal Fernando

February 20, 2014 at 7:31 am

Posted in Class Diagrams, UML

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Ruth's Reflections

Contemplations from quakey quirky Christchurch

TED Blog

The TED Blog shares interesting news about TED, TED Talks video, the TED Prize and more.


Learn and discover simple things

Meihta Dwiguna Saputra's Knowledge Base

~In learning you will teach and in teaching you will (re)learn~

The Java Blog

Thoughts, tips and tricks about the Java programming language


that were shone when I got tempered!

%d bloggers like this: