PRESENTATION OF SOFTWARE
ENGINEERING
TOPIC:-
CLASS DIAGRAMS
Assignment #2
Submitted to:-
Sir Muhammad Tausif
Date:-
29-MARCH-2017
GROUP (A) MEMBERS:
• Mubariz Hamza Aslam (FA15-BCS-152)
• Muhammad Junaid Hanif (FA15-BCS-132)
• Muzamil Hayat Khan (FA15-BCS-080)
• Muhammad Basit Ali (FA15-BCS-064)
• Muhammad Ahsan Munir (FA15-BCS-062)
OVERVIEW:
• The class diagram is a static diagram. It represents the static view of
an application. Class diagram is not only used for visualizing,
describing and documenting different aspects of a system but also
for constructing executable code of the software application.
• The class diagram describes the attributes and operations of a class
and also the constraints imposed on the system. The class diagrams
are widely used in the modelling of object oriented systems because
they are the only UML diagrams which can be mapped directly with
object oriented languages. The class diagram is the main building
block of object-oriented modeling.
Mubariz Hamza
Aslam
It is used both for
• General conceptual modeling of the systematic of the
application.
• Detailed modeling translating the models into programming
code.
Class diagrams can also be used for
• Data modeling.
• The classes in a class diagram represent both the main
elements, interactions in the application, and the classes to be
programmed.
• The class diagram shows a collection of classes, interfaces,
associations, collaborations and constraints. It is also known as
a structural diagram.
• Class diagrams provide a structural view of systems.
• Class diagrams capture the static structure of object
• Oriented systems, or how they are structured rather than how
they behave.
• Class diagrams support architectural design.
• Class diagrams represents the basics of Object.
• Oriented systems. They identify what Classes there are, how
they interrelate and how they interact.
CLASS NOTATION:
UML class is represented by the diagram shown below. The
diagram is divided into four parts.
• The top section is used to name the class.
• The second one is used to show the attributes of the class.
• The third section is used to describe the operations performed
by the class.
• The fourth section is optional to show any additional
components.
Muhammad Junaid Hanif
Classes are used to represent objects. Objects can be anything having properties and resp
OBJECT NOTATION:
The object is represented in the same way as the class. The only
difference is the name which is underlined as shown below.
As object is the actual implementation of a class which is known
as the instance of a class. So it has the same usage as the class.
PURPOSE
• The purpose of the class diagram is to model the static
view of an application. The class diagrams are the only
diagrams which can be directly mapped with object
oriented languages and thus widely used at the time of
construction.
• The UML diagrams like activity diagram, sequence diagram
can only give the sequence flow of the application but
class diagram is a bit different. So it is the most popular
UML diagram in the coder community.
Muzamil Hayat Khan
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.
WHERE TO USE CLASS DIAGRAMS?
Class diagram is a static diagram and it is used to model static view of
a system. The static view describes the vocabulary of the system.
• Class diagram is also considered as the foundation for component
and deployment diagrams. Class diagrams are not only used to
visualize the static view of the system but they are also used to
construct the executable code for forward and reverse engineering of
any system.
• Generally UML diagrams are not directly mapped with any object
oriented programming languages but the class diagram is an
exception.
Class diagram clearly shows the mapping with object oriented
languages like Java, C++ etc. So from practical experience class
diagram is generally used for construction purpose.
So in a brief, class diagrams are used for:
• Describing the static view of the system.
• Showing the collaboration among the elements of the static
view.
• Describing the functionalities performed by the system.
• Construction of software applications using object oriented
languages.
HOW TO DRAW CLASS DIAGRAM
• 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.
Muhammad Basit
Ali
The following points should be remembered while drawing a class
diagram:
• The name of the class diagram should be meaningful to describe the
aspect of the system.
• Each element and their relationships should be identified in advance.
• Responsibility (attributes and methods) of each class should be
clearly identified.
• For each class minimum number of properties should be specified.
Because unnecessary properties will make the diagram complicated.
• Use notes whenever required to describe some aspect of the
diagram. Because at the end of the drawing it should be
understandable to the developer/coder.
• Finally, before making the final version, the diagram should be drawn
Now the following diagram is an example of an Order System of
an application. So it describes a particular aspect of the entire
application.
• First of all Order and Customer are identified as the two
elements of the system and they have a one to
many relationship because a customer can have multiple
orders.
• We would keep Order class is an abstract class and it has two
concrete classes (inheritance
relationship) SpecialOrder and NormalOrder.
• The two inherited classes have all the properties as
the Order class. In addition they have additional functions
like dispatch () and receive ().
So the following class diagram has been drawn
considering all the points mentioned previous:
EXAMPLE OF PROJECT (ATM MACHINE)
• Shown below is the class diagram for the ATM system. The
basic structure of the class diagram arises from the
responsibilities and relationships discovered when doing the
CRC cards and Interaction Diagrams. (If a class uses another
class as a collaborator, or sends a message to an object of that
class during an Interaction, then there must either be an
association linking objects of those classes, or linking the
"sending" class to an object which provides access to an object
of the "receiving" class.)
Muhammad Ahsan Munir
• In the case of the ATM system, one of the responsibilities of the
ATM is to provide access to its component parts for Session
and Transaction objects; thus, Session and Transaction have
associations to ATM, which in turn has associations to the
classes representing the individual component parts. (Explicit
"uses" links between Session and Transaction, on the one hand,
and the component parts of the ATM, on the other hand, have
been omitted from the diagram to avoid making it excessively
cluttered.)
The need for the various classes in the diagram was discovered
at various points in the design process.
• Some classes were discovered when doing analysis (see
the Analysis Class Diagram developed earlier.)
• Some classes were discovered when doing CRC cards
• Message - used to represent a message to the bank.
• Receipt - used to encapsulate information to be printed on a receipt.
• Status - used to represent return value from message to the bank.
• Balances - used to record balance information returned by the bank.
Some classes were discovered when doing detailed design or
writing code
• Money - used to represent money amounts, in numerous places.
• AccountInformation - contains names of various types of
accounts customer can choose from That is, OO design is not a
"waterfall" process - discoveries made when doing detailed
design and coding can impact overall system design.
To prevent the diagram
from becoming overly
large, only the name of
each class is shown - the
attribute and behavior
"compartments" are shown
in the detailed design, but
are omitted here.
Class Diagrams

Class Diagrams

  • 1.
    PRESENTATION OF SOFTWARE ENGINEERING TOPIC:- CLASSDIAGRAMS Assignment #2 Submitted to:- Sir Muhammad Tausif Date:- 29-MARCH-2017
  • 2.
    GROUP (A) MEMBERS: •Mubariz Hamza Aslam (FA15-BCS-152) • Muhammad Junaid Hanif (FA15-BCS-132) • Muzamil Hayat Khan (FA15-BCS-080) • Muhammad Basit Ali (FA15-BCS-064) • Muhammad Ahsan Munir (FA15-BCS-062)
  • 3.
    OVERVIEW: • The classdiagram is a static diagram. It represents the static view of an application. Class diagram is not only used for visualizing, describing and documenting different aspects of a system but also for constructing executable code of the software application. • The class diagram describes the attributes and operations of a class and also the constraints imposed on the system. The class diagrams are widely used in the modelling of object oriented systems because they are the only UML diagrams which can be mapped directly with object oriented languages. The class diagram is the main building block of object-oriented modeling. Mubariz Hamza Aslam
  • 4.
    It is usedboth for • General conceptual modeling of the systematic of the application. • Detailed modeling translating the models into programming code. Class diagrams can also be used for • Data modeling. • The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed.
  • 5.
    • The classdiagram shows a collection of classes, interfaces, associations, collaborations and constraints. It is also known as a structural diagram. • Class diagrams provide a structural view of systems. • Class diagrams capture the static structure of object • Oriented systems, or how they are structured rather than how they behave. • Class diagrams support architectural design. • Class diagrams represents the basics of Object. • Oriented systems. They identify what Classes there are, how they interrelate and how they interact.
  • 6.
    CLASS NOTATION: UML classis represented by the diagram shown below. The diagram is divided into four parts. • The top section is used to name the class. • The second one is used to show the attributes of the class. • The third section is used to describe the operations performed by the class. • The fourth section is optional to show any additional components. Muhammad Junaid Hanif
  • 7.
    Classes are usedto represent objects. Objects can be anything having properties and resp
  • 8.
    OBJECT NOTATION: The objectis represented in the same way as the class. The only difference is the name which is underlined as shown below. As object is the actual implementation of a class which is known as the instance of a class. So it has the same usage as the class.
  • 9.
    PURPOSE • The purposeof the class diagram is to model the static view of an application. The class diagrams are the only diagrams which can be directly mapped with object oriented languages and thus widely used at the time of construction. • The UML diagrams like activity diagram, sequence diagram can only give the sequence flow of the application but class diagram is a bit different. So it is the most popular UML diagram in the coder community. Muzamil Hayat Khan
  • 10.
    So the purposeof 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.
  • 11.
    WHERE TO USECLASS DIAGRAMS? Class diagram is a static diagram and it is used to model static view of a system. The static view describes the vocabulary of the system. • Class diagram is also considered as the foundation for component and deployment diagrams. Class diagrams are not only used to visualize the static view of the system but they are also used to construct the executable code for forward and reverse engineering of any system. • Generally UML diagrams are not directly mapped with any object oriented programming languages but the class diagram is an exception.
  • 12.
    Class diagram clearlyshows the mapping with object oriented languages like Java, C++ etc. So from practical experience class diagram is generally used for construction purpose. So in a brief, class diagrams are used for: • Describing the static view of the system. • Showing the collaboration among the elements of the static view. • Describing the functionalities performed by the system. • Construction of software applications using object oriented languages.
  • 13.
    HOW TO DRAWCLASS DIAGRAM • 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. Muhammad Basit Ali
  • 14.
    The following pointsshould be remembered while drawing a class diagram: • The name of the class diagram should be meaningful to describe the aspect of the system. • Each element and their relationships should be identified in advance. • Responsibility (attributes and methods) of each class should be clearly identified. • For each class minimum number of properties should be specified. Because unnecessary properties will make the diagram complicated. • Use notes whenever required to describe some aspect of the diagram. Because at the end of the drawing it should be understandable to the developer/coder. • Finally, before making the final version, the diagram should be drawn
  • 15.
    Now the followingdiagram is an example of an Order System of an application. So it describes a particular aspect of the entire application. • First of all Order and Customer are identified as the two elements of the system and they have a one to many relationship because a customer can have multiple orders. • We would keep Order class is an abstract class and it has two concrete classes (inheritance relationship) SpecialOrder and NormalOrder. • The two inherited classes have all the properties as the Order class. In addition they have additional functions like dispatch () and receive ().
  • 16.
    So the followingclass diagram has been drawn considering all the points mentioned previous:
  • 17.
    EXAMPLE OF PROJECT(ATM MACHINE) • Shown below is the class diagram for the ATM system. The basic structure of the class diagram arises from the responsibilities and relationships discovered when doing the CRC cards and Interaction Diagrams. (If a class uses another class as a collaborator, or sends a message to an object of that class during an Interaction, then there must either be an association linking objects of those classes, or linking the "sending" class to an object which provides access to an object of the "receiving" class.) Muhammad Ahsan Munir
  • 18.
    • In thecase of the ATM system, one of the responsibilities of the ATM is to provide access to its component parts for Session and Transaction objects; thus, Session and Transaction have associations to ATM, which in turn has associations to the classes representing the individual component parts. (Explicit "uses" links between Session and Transaction, on the one hand, and the component parts of the ATM, on the other hand, have been omitted from the diagram to avoid making it excessively cluttered.)
  • 19.
    The need forthe various classes in the diagram was discovered at various points in the design process. • Some classes were discovered when doing analysis (see the Analysis Class Diagram developed earlier.) • Some classes were discovered when doing CRC cards • Message - used to represent a message to the bank. • Receipt - used to encapsulate information to be printed on a receipt. • Status - used to represent return value from message to the bank. • Balances - used to record balance information returned by the bank.
  • 20.
    Some classes werediscovered when doing detailed design or writing code • Money - used to represent money amounts, in numerous places. • AccountInformation - contains names of various types of accounts customer can choose from That is, OO design is not a "waterfall" process - discoveries made when doing detailed design and coding can impact overall system design.
  • 21.
    To prevent thediagram from becoming overly large, only the name of each class is shown - the attribute and behavior "compartments" are shown in the detailed design, but are omitted here.