A class diagram is an illustration of the relationships and source
code dependencies among classes in the Unified Modeling Language (UML). In this
context, a class defines the methods and variables in an object, which is a
specific entity in a program or the unit of code representing that entity.
In a class diagram, the classes are arranged in groups that share
common characteristics. A class diagram resembles a flowchart in which classes
are portrayed as boxes, each box having three rectangles inside. The top
rectangle contains the name of the class; the middle rectangle contains the
attributes of the class; the lower rectangle contains the methods, also called
operations, of the class. Lines, which may have arrows at one or both ends,
connect the boxes. These lines define the relationships, also called
associations, between the classes.
So the purpose of the class diagram can be summarized as:
- Analysis and design of the static view of an application.
- Describe responsibilities of a system.
- Base for component and deployment diagrams.
- Forward and reverse engineering.
Class diagrams are the most popular UML diagrams used for
construction of software applications. So it is very important to learn the
drawing procedure of class diagram. Class diagrams have lot of properties to
consider while drawing but here the diagram will be considered from a top level
view. Class diagram is basically a graphical representation of the static view
of the system and represents different aspects of the application. So a collection
of class diagrams represent the whole system.
Class
A class represents an
entity of a given system that provides an encapsulated implementation of
certain functionality of a given entity. These are exposed by the class to
other classes as methods. Apart from business functionality, a class also has
properties that reflect unique features of a class. The properties of a class
are called as attributes. The UML representation of a class is a rectangle
containing three compartments stacked vertically
Association
An association represents a relationship between two classes. An
association indicates that objects of one class have a relationship with
objects of another class, in which this connection has a specifically defined
meaning.
This is the example of class diagram about blog system:
Mengelola Comment
(addComment, viewComment, replyComment)
Attribute : isi_comment, tgl_comment, panjang_isiComment, email
Operation : set_isiComment, get_isiComment, set_tglComment, get_tglComment
Mengelola Profil
(addNewProfil, editProfil)
Attribute : id_profil, nama_profil, email
Operation : set_idProfil, set_namaAdmin, get_namaAdmin
Mengelola Template
(editHtml, cadangkan/pulihkan)
Attribute : isi_html
Operation : set_isiHtml, get_isiHtml
Mengelola Posting
(inputNewPosting, editPosting, deletePosting, viewPosting)
Attribute : isi_posting, tgl_posting, panjang_isiPosting
Operation : set_isiPosting, get_isiPosting, set_tglPosting, get_tglPosting
Mengelola Layout
(addGadget, editGadget, deleteGadget)
Attribute : isi_gadget
Operation : set_isiGadget, get_isiGadget
Monetize Blog
(approveIklan)
Attribute : id_iklan, email, isi_iklan, tgl_iklan
Operation : get_idIklan, set_isiIklan, get_isiIklan, set_tglIklan,
get_tglIklan