Class Diagram. Diagram kelas yang bisa dibilang tipe UML diagram yang paling sering digunakan.ini-contoh-diagram-uml-dan17.html,anda boleh menyebar luaskannya atau mengcopy paste-nya jika artikel Berikut Ini Contoh DIAGRAM UML dan FUNGSINYA 2 ini sangat bermanfaat bagi teman-teman anda,namun jangan lupa untuk meletakkan link Berikut Ini. Untuk memulai membuat sebuah class diagram, kita harus mengetahui persoalan apa yang sedang dihadapi untuk merancang tabelnya. Langkah pertama adalah membuat sebuah class. Yaitu dengan mengklik Class yang berada pada toolbox di sebelah kiri layar.
Relations between classes
Relations between classes are defined using the following symbols :
Type | Symbol | Drawing |
Extension | <|-- |
|
Composition | *-- |
|
Aggregation | o-- |
It is possible to replace
--
by ..
to have a dotted line.
Knowing those rules, it is possible to draw the following drawings:
Label on relations
It is possible a add a label on the relation, using
:
, followed by the text of the label.
For cardinality, you can use double-quotes
'
on each side of the relation.
You can add an extra arrow pointing at one object showing which object acts on the other object, using
<
or >
at the begin or at the end of the label.
Adding methods
To declare fields and methods, you can use the symbol
:
followed by the field's or method's name.
The system checks for parenthesis to choose between methods and fields.
It is also possible to group between brackets
{}
all fields and methods.
Note that the syntax is highly flexible about type/name order.
You can use
{field}
and {method}
modifiers to override default behaviour of the parser about fields and methods.
Defining visibility
When you define methods or fields, you can use characters to define the visibility of the corresponding item:
Character | Icon for field | Icon for method | Visibility |
- |
private | ||
# |
protected | ||
~ |
package private | ||
+ |
public |
You can turn off this feature using the
skinparam classAttributeIconSize 0
command :
Abstract and Static
You can define static or abstract methods or fields using the
{static}
or {abstract}
modifier.
These modifiers can be used at the start or at the end of the line. You can also use
{classifier}
instead of {static}
.
Advanced class body
By default, methods and fields are automatically regrouped by PlantUML. You can use separators to define your own way of ordering fields and methods. The following separators are possible :
--
..
__
.
You can also use titles within the separators:
Notes and stereotypes
Stereotypes are defined with the
class
keyword, <<
and >>
.
You can also define notes using
note left of
, note right of
, note top of
, note bottom of
keywords.
You can also define a note on the last defined class using
note left
, note right
, note top
, note bottom
.
A note can be also define alone with the
note
keywords, then linked to other objects using the ..
symbol.
More on notes
It is also possible to use few html tags like :
<b>
<u>
<i>
<s>
,<del>
,<strike>
<font color='#AAAAAA'>
or<font color='colorName'>
<color:#AAAAAA>
or<color:colorName>
<size:nn>
to change font size<img src='file'>
or<img:file>
: the file must be accessible by the filesystem
You can also have a note on several lines.
You can also define a note on the last defined class using
note left
, note right
, note top
, note bottom
.
Note on links
It is possible to add a note on a link, just after the link definition, using
note on link
.
You can also use
note left on link
, note right on link
, note top on link
, note bottom on link
if you want to change the relative position of the note with the label.
Abstract class and interface
You can declare a class as abstract using
abstract'
or abstract class
keywords.
The class will be printed in italic.
You can use the
interface
, annotation
and enum
keywords too.
Using non-letters
If you want to use non-letters in the class (or enum...) display, you can either :
- Use the
as
keyword in the class definition - Put quotes
'
around the class name
Hide attributes, methods...
You can parameterize the display of classes using the
hide/show
command.
The basic command is:
hide empty members
. This command will hide attributes or methods if they are empty.
Instead of
empty members
, you can use:
empty fields
orempty attributes
for empty fields,empty methods
for empty methods,fields
orattributes
which will hide fields, even if they are described,methods
which will hide methods, even if they are described,members
which will hide fields and methods, even if they are described,circle
for the circled character in front of class name,stereotype
for the stereotype.
You can also provide, just after the
hide
or show
keyword:
class
for all classes,interface
for all interfaces,enum
for all enums,<<foo1>>
for classes which are stereotyped with foo1,- an existing class name.
You can use several
show/hide
commands to define rules and exceptions.
Hide classes
You can also use the
show/hide
commands to hide classes.
This may be useful if you define a large !included file, and if you want to hide come classes after file inclusion.
Use generics
You can also use bracket
<
and >
to define generics usage in a class.
It is possible to disable this drawing using
skinparam genericDisplay old
command.
Specific Spot
Usually, a spotted character (C, I, E or A) is used for classes, interface, enum and abstract classes.
But you can define your own spot for a class when you define the stereotype, adding a single character and a color, like in this example:
Packages
You can define a package using the
package
keyword, and optionally declare a background color for your package (Using a html color code or name).
Note that package definitions can be nested.
Packages style
There are different styles available for packages.
You can specify them either by setting a default style with the command :
skinparam packageStyle
, or by using a stereotype on the package:
You can also define links between packages, like in the following example:
Namespaces
In packages, the name of a class is the unique identifier of this class. It means that you cannot have two classes with the very same name in different packages.
In that case, you should use namespaces instead of packages.
You can refer to classes from other namespaces by fully qualify them. Classes from the default namespace are qualified with a starting dot.
Note that you don't have to explicitly create namespace : a fully qualified class is automatically put in the right namespace.
Automatic namespace creation
You can define another separator (other than the dot) using the command :
set namespaceSeparator ???
.
You can disable automatic package creation using the command
set namespaceSeparator none
.
Lollipop interface
You can also define lollipops interface on classes, using the following syntax:
bar ()- foo
bar ()-- foo
foo -() bar
Changing arrows direction
By default, links between classes have two dashes
--
and are vertically oriented. It is possible to use horizontal link by putting a single dash (or dot) like this:
You can also change directions by reversing the link:
It is also possible to change arrow direction by adding
left
, right
, up
or down
keywords inside the arrow:
You can shorten the arrow by using only the first character of the direction (for example,
-d-
instead of -down-
) or the two first characters (-do-
).
Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking.
Association classes
You can define association class after that a relation has been defined between two classes, like in this example:
You can define it in another direction:
Skinparam
You can use the
skinparam
command to change colors and fonts for the drawing.
You can use this command :
- In the diagram definition, like any other commands,
- In an included file,
- In a configuration file, provided in the command line or the ANT task.
Skinned Stereotypes
You can define specific color and fonts for stereotyped classes.
Color gradient
It's possible to declare individual color for classes or note using the # notation.
You can use either standard color name or RGB code.
You can also use color gradient in background, with the following syntax: two colors names separated either by:
|
,/
,,
- or
-
For example, you could have:
Help on layout
Sometimes, the default layout is not perfect...
You can use
together
keyword to group some classes together : the layout engine will try to group them (as if they were in the same package).
You can also use
hidden
links to force the layout.
Splitting large files
Sometimes, you will get some very large image files.
You can use the
page (hpages)x(vpages)
command to split the generated image into several files :
hpages
is a number that indicated the number of horizontal pages, and vpages
is a number that indicated the number of vertical pages.
You can also use some specific skinparam settings to put borders on splitted pages (see example).
ERD vs Class Diagram
Class Diagram
This term is used in the software field. In one of the languages of software called “UML” or “Unified Modeling Language,” there are structure diagrams which describe or show the structure of any system by the help of showing the classes of the system. These diagrams also show the operations of the classes, attributes, and relationships between different classes. These diagrams which describe the classes with the help of diagrams are called class diagrams.
In object-oriented modeling, a class diagram is the primary block for building the whole structure. Class diagrams are used for two main things:
They are used for the conceptual modeling of the systematic application.
Detailed modeling in order to translate into programming codes.
Class Diagram
This term is used in the software field. In one of the languages of software called “UML” or “Unified Modeling Language,” there are structure diagrams which describe or show the structure of any system by the help of showing the classes of the system. These diagrams also show the operations of the classes, attributes, and relationships between different classes. These diagrams which describe the classes with the help of diagrams are called class diagrams.
In object-oriented modeling, a class diagram is the primary block for building the whole structure. Class diagrams are used for two main things:
They are used for the conceptual modeling of the systematic application.
Detailed modeling in order to translate into programming codes.
The class diagrams have many classes and subclasses, and these classes show the chief object, its interaction with other classes, and the objects which need to be programmed. These three classes are represented in the class diagrams with the help of boxes. These boxes contain three different parts. The uppermost part contains the class name, the middle one holds class attributes, and the bottom part contains the operations which can be taken by the class.
As these class diagrams are used to represent the system design, the classes are identified and sorted together to show the relationship between the objects. The representation is a static diagram which is the class diagram.
As these class diagrams are used to represent the system design, the classes are identified and sorted together to show the relationship between the objects. The representation is a static diagram which is the class diagram.
Source
http://www.google.com/search?q=class+diagram&hl=en&safe=off&prmd=ivns&tbm=isch&tbo=u&source=univ&sa=X&ei=99TxTf_-FYLOrQfj1pj6Bw&ved=0CCgQsAQ&biw=1680&bih=929
http://www.google.com/search?q=class+diagram&hl=en&safe=off&prmd=ivns&tbm=isch&tbo=u&source=univ&sa=X&ei=99TxTf_-FYLOrQfj1pj6Bw&ved=0CCgQsAQ&biw=1680&bih=929
ERD (Entity Relationship Diagrams)
The conceptual as well as abstract representation of data in software engineering is called entity-relationship modeling. This modeling is used to model a database. It is a method by which the conceptual model of a system is produced. The diagrams produced by this method are called entity-relationship diagrams. These diagrams do not show one single entity; they show a set of entities or a set of relationships.
The sets of entities are represented by rectangles, and diamonds represent relationship sets in an ERD. A line connects when a relationship entity is participated in by an entity set. Ovals are used to represent attributes. The ERDs are used to represent the information or type of information required to be stored in a database. They are used as a requirement for analysis.
Source
http://www.google.com/search?q=ERD&hl=en&safe=off&prmd=ivns&tbm=isch&tbo=u&source=univ&sa=X&ei=ANfxTZXrGY3SrQe5nf35Bw&ved=0CFAQsAQ&biw=1680&bih=929
http://www.google.com/search?q=ERD&hl=en&safe=off&prmd=ivns&tbm=isch&tbo=u&source=univ&sa=X&ei=ANfxTZXrGY3SrQe5nf35Bw&ved=0CFAQsAQ&biw=1680&bih=929
Summary:
The class diagrams are used to represent the main object or building block of the system. They are used to show the relationship of one class with another and also represent the attributes of the system. However, an ERD is more of a database in the form of tables. They do not show individual relationships but relationship sets as well as sets of entities. They show the type of information that needs to be stored in the database.
The class diagram and the ERD have very different graphic representations.
The class diagrams are used to represent the main object or building block of the system. They are used to show the relationship of one class with another and also represent the attributes of the system. However, an ERD is more of a database in the form of tables. They do not show individual relationships but relationship sets as well as sets of entities. They show the type of information that needs to be stored in the database.
The class diagram and the ERD have very different graphic representations.
Nimisha Kaushik
Latest posts by Nimisha Kaushik (see all)
- Difference Between Data Mining and Data Warehousing - October 21, 2012
- Difference Between 7-Keto DHEA and DHEA - October 20, 2012
- Difference Between Tamil and Malayalam - October 18, 2012