CST 205 Object Oriented Programming using Java
CST 281 Object Oriented Programming
(As per KTU 2019 Syllabus)
Course overview & Module 1
Module 1
► Approaches to Software Design. Functional Oriented Design, Object
Oriented Design, Case Study of Automated Fire Alarm System
► Object Modeling Using Unified Modeling Language. Basic Object Oriented
concepts, UML diagrams, Use case model, Class diagram, Interaction diagram,
Activity diagram, State chart diagram
► Introduction to Java Java programming. Environment and Runtime
Environment, Development Platforms - Standard, Enterprise. Java Virtual
Machine, Java compiler, Bytecode, Java applet Java Buzzwords, Java program
structure, Comments, Garbage Collection, Lexical Issues
Class Diagram
● Class diagram in the UML is a type of static structure diagram to represent the
design of the software system in terms of classes and their relationships..
● It shows the structure of a system at the level of classes and interfaces, along
with their attributes, operations, and the relationships among objects.
● There are several software tools available create UML Class diagrams. Rational
rose, StarUML and Lucidchart are some of the popular tools.
● Some common types of class diagrams are:
1. Domain Model Diagram - representation of real-world conceptual classes (contains only attributes),
not of software components, to understand the project domain.
2. Implementation Classes Diagram - representation of the structure of software components,
describes classes, interfaces, associations, usage, realization.
UML notation for Class
A class notation consists of three parts:
1. Class Name (mandatory):
○ The name of the class appears in the first
partition.
2. Class Attributes[optional]:
○ An attribute is a named property of a class that
describes the object being modeled
○ Attributes are shown in the second partition.
○ The attribute type is shown after the colon.
○ Derived attribute is designated by a preceding ‘/’
○ Attributes map onto member variables (data members) in code.
3. Class Operations(Methods)[optional]:
○ Operations are shown in the third partition. They are services the class provides.
○ The return type of a method is shown after the colon at the end of the method signature.
○ Operations map onto class methods in code
Member visibility
● Visibility defines whether attributes and
operations of specific classes can be seen and
used by other classes
● UML has 4 types of visibility and it is
represented by prefixing a literal( +, -, #, ~)
Member visibility
PRIVATE
DEFAULT /
PACKAGE
PUBLIC
PROTECTED
Member scope
● The UML specifies two types of scope for
members: instance and classifier.
● Classifier members are commonly
recognized as “static” in many programming
languages. The scope is the class itself.
○ All the instances share the classifier scoped
members.
● To indicate a classifier scope for a member,
its name must be underlined. Otherwise,
instance scope is assumed by default.
● Instance members are scoped to a specific
instance.
○ Each instantiated object of the class has its own
copy of the instance members.
Relationships between classes
Relationships in class diagrams include
different types of logical connections.
Relationships between classes
1. Association
● Represents static relationships between two classes.
● Shows that instances of classes could be either linked to each
other or combined logically or physically.
● Represented by a solid line (with or without open arrow)
connecting two classes
2. Dependency
● A dependency means the relation between two or more classes
in which a change in one may force changes in the other.
● Dependency indicates that one class depends on another.
● A dashed line with an open arrow
Relationships between classes
4. Aggregation
● A special type of association to represent a "has a" relationship eg. Team has 9 Players
● A solid line with an unfilled diamond at the association end connected to the class of
composite
5. Composition
● A special type of aggregation where parts are destroyed when the whole is destroyed.
● A solid line with a filled diamond at the association connected to the class of composite
Relationships between classes
6. Generalization (Inheritance)
● A generalization helps to connect a subclass to its superclass.
● A sub-class is inherited from its superclass.
● A solid line with a hollow arrowhead that point from the child to the parent class
7. Realization (Implements)
● Realization relationship is a relationship between two model elements, in which
one model element (the client) realizes (implements or executes) the behavior
that the other model element (the supplier) specifies.
Relationships between classes
Multiplicity
● Multiplicity defines how
many objects participate in a
relationship and it is the
number of instances of one
class related to one instance
of the other class.
● Multiplicity is represented as
a number and a * is used to
represent a multiplicity of
many
Class diagram for a Pizza Order system
References
● Rajib Mall, Fundamentals of Software Engineering, 4th edition, PHI, 2014.
● UML Diagrams - www.uml-diagrams.org
● Visual Paradigm - www.visual-paradigm.com
● GeeksforGeeks - www.geeksforgeeks.org
● Wikipedia - www.wikipedia.org
● Tutorialspoint - www.tutorialspoint.com
● Disclaimer - This document contains images/texts from various internet sources. Copyright belongs to the
respective content creators. Document is compiled exclusively for study purpose and shall not be used for
commercial purpose.

Lecture 4-oop class diagram

  • 1.
    CST 205 ObjectOriented Programming using Java CST 281 Object Oriented Programming (As per KTU 2019 Syllabus) Course overview & Module 1
  • 2.
    Module 1 ► Approachesto Software Design. Functional Oriented Design, Object Oriented Design, Case Study of Automated Fire Alarm System ► Object Modeling Using Unified Modeling Language. Basic Object Oriented concepts, UML diagrams, Use case model, Class diagram, Interaction diagram, Activity diagram, State chart diagram ► Introduction to Java Java programming. Environment and Runtime Environment, Development Platforms - Standard, Enterprise. Java Virtual Machine, Java compiler, Bytecode, Java applet Java Buzzwords, Java program structure, Comments, Garbage Collection, Lexical Issues
  • 3.
    Class Diagram ● Classdiagram in the UML is a type of static structure diagram to represent the design of the software system in terms of classes and their relationships.. ● It shows the structure of a system at the level of classes and interfaces, along with their attributes, operations, and the relationships among objects. ● There are several software tools available create UML Class diagrams. Rational rose, StarUML and Lucidchart are some of the popular tools. ● Some common types of class diagrams are: 1. Domain Model Diagram - representation of real-world conceptual classes (contains only attributes), not of software components, to understand the project domain. 2. Implementation Classes Diagram - representation of the structure of software components, describes classes, interfaces, associations, usage, realization.
  • 4.
    UML notation forClass A class notation consists of three parts: 1. Class Name (mandatory): ○ The name of the class appears in the first partition. 2. Class Attributes[optional]: ○ An attribute is a named property of a class that describes the object being modeled ○ Attributes are shown in the second partition. ○ The attribute type is shown after the colon. ○ Derived attribute is designated by a preceding ‘/’ ○ Attributes map onto member variables (data members) in code. 3. Class Operations(Methods)[optional]: ○ Operations are shown in the third partition. They are services the class provides. ○ The return type of a method is shown after the colon at the end of the method signature. ○ Operations map onto class methods in code
  • 5.
    Member visibility ● Visibilitydefines whether attributes and operations of specific classes can be seen and used by other classes ● UML has 4 types of visibility and it is represented by prefixing a literal( +, -, #, ~)
  • 6.
  • 7.
    Member scope ● TheUML specifies two types of scope for members: instance and classifier. ● Classifier members are commonly recognized as “static” in many programming languages. The scope is the class itself. ○ All the instances share the classifier scoped members. ● To indicate a classifier scope for a member, its name must be underlined. Otherwise, instance scope is assumed by default. ● Instance members are scoped to a specific instance. ○ Each instantiated object of the class has its own copy of the instance members.
  • 8.
    Relationships between classes Relationshipsin class diagrams include different types of logical connections.
  • 9.
    Relationships between classes 1.Association ● Represents static relationships between two classes. ● Shows that instances of classes could be either linked to each other or combined logically or physically. ● Represented by a solid line (with or without open arrow) connecting two classes 2. Dependency ● A dependency means the relation between two or more classes in which a change in one may force changes in the other. ● Dependency indicates that one class depends on another. ● A dashed line with an open arrow
  • 10.
    Relationships between classes 4.Aggregation ● A special type of association to represent a "has a" relationship eg. Team has 9 Players ● A solid line with an unfilled diamond at the association end connected to the class of composite 5. Composition ● A special type of aggregation where parts are destroyed when the whole is destroyed. ● A solid line with a filled diamond at the association connected to the class of composite
  • 11.
    Relationships between classes 6.Generalization (Inheritance) ● A generalization helps to connect a subclass to its superclass. ● A sub-class is inherited from its superclass. ● A solid line with a hollow arrowhead that point from the child to the parent class 7. Realization (Implements) ● Realization relationship is a relationship between two model elements, in which one model element (the client) realizes (implements or executes) the behavior that the other model element (the supplier) specifies.
  • 12.
    Relationships between classes Multiplicity ●Multiplicity defines how many objects participate in a relationship and it is the number of instances of one class related to one instance of the other class. ● Multiplicity is represented as a number and a * is used to represent a multiplicity of many
  • 13.
    Class diagram fora Pizza Order system
  • 14.
    References ● Rajib Mall,Fundamentals of Software Engineering, 4th edition, PHI, 2014. ● UML Diagrams - www.uml-diagrams.org ● Visual Paradigm - www.visual-paradigm.com ● GeeksforGeeks - www.geeksforgeeks.org ● Wikipedia - www.wikipedia.org ● Tutorialspoint - www.tutorialspoint.com ● Disclaimer - This document contains images/texts from various internet sources. Copyright belongs to the respective content creators. Document is compiled exclusively for study purpose and shall not be used for commercial purpose.