OOAD Mid Term Notes (Complete)
OOAD Mid Term Notes (Complete)
The larger and more complex a system, the more crucial modeling becomes.
Benefits of model
Through modelling we achieve four aims:
What is UML?
Unified Modeling Language (UML) is a standardized visual modeling language used in
software engineering.
Things in UML
Things are the most important building blocks of UML. Things can be 4 type
1. Structural Things
2. Behavioral Things
3. Grouping Things
4. Annotation Things
Structural things
Structural things define the static part of the model. They represent the physical
and conceptual elements. There are seven kinds of structural things.
1. Class:
Class represents a set of objects having similar responsibilities.
Fig:1 Fig:2
Visibility symbols are used to determine the accessibility of the information contained
in classes.
Note: The “+” represents public operations, vice versa, “-” represents private operations.
Plus, “#” is for the protected operations.
4. Use case:
Use case represents a set of actions performed by a system for a
specific goal.
5. Active class:
Active class looks similar to a class with double lines on the left and right or a solid
border. Active class is generally used to describe the concurrent behavior of a system.
concurrent=somosamoyik
Fig: 1 Fig: 2
6. Component:
Component describes the physical part of a system.
7. Node:
A node can be defined as a physical element that exists at run
time.
Behavioral Things
A behavioral thing consists of the dynamic parts of UML models. There
are two kinds of behavioral things.
1. Interaction: Symbol
Interaction
is defined as a behavior that consists of a group of
messages exchanged among elements to accomplish a specific task.
1. State machine: Different obj of a single state of a single obj in the lifetime
Specifiesthe sequence of states that an object or an interaction
goes through during its lifetime in response to events.
Grouping Things
It is a method that together binds the elements of the UML model. In UML, the
package is the only thing, which is used for grouping.
Package: Package is the only thing that is available for grouping behavioral and
structural things.
Fig:1
Fig:2 Fig:3
Annotation Things
note: annotation captures recode
Note: It is used to attach the constraints, comments, and rules to the elements of
the model. It is a kind of yellow sticky note.
Fig:1
Fig:2 Fig:3
Relationships in UML
There are four kinds of relationships in the UML
Association
Generalization
Realization
Dependency
1. Association:
Association is basically a set of links that connects the elements of a UML
model. It also describes how many objects are taking part in that
relationship.
2. Generalization:
Generalization can be defined as a relationship which connects a specialized
element with a generalized element. It basically describes the inheritance
relationship in the world of objects.
Example:
Fig:1 Fig:2
3. Realization:
Realization can be defined as a relationship in which two elements are
connected. One element describes some responsibility, which is not
implemented and the other one implements them. This relationship exists in
case of interfaces.
Example:
4. Dependency:
Dependency is a relationship between two things in which change in one
element also affects the other.
Example:
The visual effect of the UML diagram is the most important part of the
entire process. All the other elements are used to make it complete.
Object diagram
Shows a set of objects and their relationships. Object diagrams represent static
snapshots on instances of the things found in class diagrams. These designs
address the static design or process view of a system from the perspective of
real or prototypical cases.
Component diagram
Shows an encapsulated class and its interfaces, ports, and internal structure
consisting of nested components and connectors. Component diagrams
address the static design implementation view of a system.
Deployment diagram
Shows the configuration of run-time processing nodes and the components
that live on them. Deployment diagrams address the static deployment view
of an architecture (networking). A node typically hosts one or more artifacts.
Interaction diagram
Shows an interaction, consisting of a set of objects or roles, including the
messages that may be dispatched among them. Interaction diagrams address
the dynamic view of a system. Both sequence diagrams and communication
diagrams are kinds of interaction diagrams.
A sequence diagram is an interaction diagram that emphasizes the time-
ordering of messages.
A communication diagram is an interaction diagram that emphasizes the
structural organization of the objects or roles that send and receive
messages.
Dynamic view:state interaction er activity ta timing laga
State diagram
Shows a state machine, consisting of states, transitions, events, and activities.
A state diagrams shows the dynamic view of an object.
Activity diagram
Shows the structure of a process or other computation as the flow of control
and data from step to step within the computation. Activity diagrams address
the dynamic view of a system. They are especially important in modeling the
function of a system and emphasize the flow of control among objects.
Deployment diagram
Shows the configuration of run-time processing nodes and the components
that live on them. Deployment diagrams address the static deployment view
of an architecture (networking). A node typically hosts one or more artifacts.
shortcut: ISA
shortcut:ISA
shortcut:ISA
shortcut:ISA
note:use case er behavior and design er vocuabulary and interaction er performance and implementatin er
physical system and deployment er distributation valo..
SDLC – Rational Unified Model (RUP)
Inception is the first phase of the process, when the seed idea for the development
is brought up to the point of being at least internally sufficiently well-founded to
warrant entering into the elaboration phase.
Elaboration is the second phase of the process, when the product requirements
and architecture are defined. In this phase, the requirements are articulated,
prioritized, and baselined. A system's requirements may range from general vision
statements to precise evaluation criteria, each specifying particular functional or
nonfunctional behavior and each providing a basis for testing.
Construction is the third phase of the process, when the software is brought from
an executable architectural baseline to being ready to be transitioned to the user
community. Here also, the system's requirements and especially its evaluation
criteria are constantly reexamined against the business needs of the project, and
resources are allocated as appropriate to actively attack risks to the project.
Transition is the fourth phase of the process, when the software is delivered to the
user community. Rarely does the software development process end here, for even
during this phase, the system is continuously improved, bugs are eliminated, and
features that didn't make an earlier release are added.
Iteration is a distinct set of work tasks, with a baselined plan and evaluation
criteria that results in an executable system that can be run, tested, and evaluated.
Introduction
Use-cases are descriptions of the functionality of a system from a user
perspective.
Depict the behavior of the system, as it appears to an outside user.
Describe the functionality and users (actors) of the system.
Show the relationships between the actors that use the system, the use cases
(functionality) they use, and the relationship between different use cases.
Document the scope of the system.
Illustrate the developer’s understanding of the user’s requirements.
Use case diagrams contain use cases, actors, and their relationships.
1. USE Case:
Use cases specify desired behavior
The names of use cases are always written in the form of a verb followed by
an object.
Each sequence represents an interaction of actors with the system
Each Actor must be linked to a use case, while some use cases may not be
linked to actors.
2. Actor:
An actor represents a set of roles that users of use case play when interacting
with these use cases.
Actors can be human or automated systems.
Actors are entities
o which require help from the system to perform their task, or
o are needed to execute the system’s functions.
Actors are not part of the system.
A system can be an Actor of other systems
3. Communication Link:
The participation of an actor in a use case is shown by connecting an actor to a
use case by a solid link.
Actors may be connected to use cases by associations, indicating that the actor
and the use case communicate with one another using messages.
Example:
updating
grades
faculty
Fig: 1 Fig: 2
4. Boundary of system:
It is shown as a rectangle.
It helps to identify what is external versus internal, and what the
responsibilities of the system are.
The external environment is represented only by actors.
Example of Use cases diagram
Indicates the base use case will include behavior of the child use case.
They are shown as a dotted line with an open arrow and the key word
“<< include>>”
Arrowhead points to the child use case; base of the arrow connects to the parent
use case
Fig: 1 Fig: 2
2. Extends:
Indicates that an "Invalid Password" use case may include (subject to specified
in the extension) the behavior specified by base use case "Login Account".
Depict with a directed arrow having a dotted line. The tip of arrowhead
points to the base use case and the child use case is connected at the base of
the arrow.
Fig: 1
:
Fig: 2
3. Generalization:
Generalization is a relationship between a general use case and a more specific use
Fig: 1
Example of Relationships between Use cases
Extend vs Include
Use cases Example
1. Association Link:
A Use Case diagram illustrates a set of use cases for a system, i.e. the actors
and the relationships between the actors and use cases.
2. Include Relationship:
The include relationship adds additional functionality not specified in the base
use case. The <<Include>> relationship is used to include common behavior
from an included use case into a base use case in order to support the reuse of
common behavior.
3. Extend Relationship:
The extend relationships are important because they show optional
functionality or system behavior. The <<extend>> relationship is used to
include optional behavior from an extending use case in an extended use case.
Take a look at the use case diagram example below. It shows an extend
connector and an extension point "Search".
4. Generalization Relationship:
A generalization relationship means that a child use case inherits the behavior
and meaning of the parent use case. The child may add or override the
behavior of the parent. The figure below provides a use case example by
showing two generalization connectors that connect between the three use
cases.
Use Case Diagram - Vehicle Sales Systems
The figure below shows a use case diagram example for a vehicle system. As
we can see even a system as big as a vehicle sales system contains not more
than 10 use cases! That's the beauty of use case modeling.
The use case model also shows the use of extend and include. Besides, there
are associations that connect between actors and use cases.
Use cases description
Title or Reference Name - meaningful name of the UC
Author/Date - the author and creation date
Modification/Date - last modification and its date
Purpose - specifies the goal to be achieved
Overview - short description of the processes
Cross References - requirements references
Actors - agents participating
Pre-Conditions - must be true to allow execution
Post Conditions - will be set when completes normally
Normal flow of events - regular flow of activities
Alternative flow of events - other flow of activities
Exceptional flow of events - unusual situations
Implementation issues - foreseen implementation problems
Examples:
CRC CARD
Class Responsibility Collaboration
CRC goals: provide the simplest possible conceptual introduction to OO design
Class:
Class:
Descript
Class:ion:
Descript ion: FloorPlan
Class:
Descript ion:
Responsibility:
Descript ion: Collaborator:
Responsibility: Collaborator:
Responsibility: Collaborator:
Responsibility: Collaborator:
def ines f loor plan name/ty pe
manages f loor plan positioning
scales f loor plan f or display
scales f loor plan f or display
incorporates walls, doors and windows Wall
shows position of v ideo cameras Camera
1. Class Name:
The name of the class is typically written in the top compartment of the
class box and is centered and bold.
2. Attributes:
Attributes, also known as properties or fields, represent the data members of
the class. They are listed in the second compartment of the class box and
often include the visibility (e.g., public, private) and the data type of each
attribute.
3. Methods:
Methods, also known as functions or operations, represent the behavior or
functionality of the class. They are listed in the third compartment of the
class box and include the visibility (e.g., public, private), return type, and
parameters of each method.
NOTE: Classes are used to represent objects. Objects can be anything having
properties and responsibility.
4. Visibility Notation:
Visibility notations indicate the access level of attributes and methods.
Common visibility notations include:
o “+” for public (visible to all classes)
o “-” for private (visible only within the class)
o “#” for protected (visible to subclasses)
o “~” for package or default visibility (visible to classes in the same
package)
o Slash (/): The derived attribute indicator is Optional
Constraints: Constraints express all the rules required to guarantee the integrity
of this piece of information. Any time another object tries to alter the attribute
value, it must pass the rules established in the constraints. The constraints are
typically implemented/enforced in any method that attempts to set the attribute
value, e.g. {ID is assign by the system}
Drawing Class notation: Operation
visibility operationName (argname: data type {constraints}, ...):
Example:
Practice Class Notation
1. Case: 01
In a system, there is a class named Book. It has five attributes: Title, BookId,
AuthorName, Price, and Pages. All the attributes are private and Price is only accessible
by admin user. Title and AuthorName are String in type, BookId and Pages are in
integer and Price is in double. There are three methods in this class. They are:
borrowStatus() which returns a boolean value, EnableDiscount(boolean Status) which
returns nothing and setTitle(String title) which returns nothing. All the methods are
public.
2. Case: 02
Every year there are many students admitted to AIUB. AIUB authority stores different
related data of each student in their database. Basic information of students is: StudentID,
Name, CourseTeacher, CGPA, Dept, Address and Email. All information keeps private
by the university authority. The head of the department assigned the CourseTeacher for
the students every semester. All information data types in String except StudentID and
CGPA. The data type of StudentID is an integer and CGPA is double. The methods of
student’s information are: setStudentName(String Name), setStudentDOB(String
DOB), setBloodGroup (String BloodGroup), getCGPA(), and setStudentDept(). Only
getCGPA() method returns a double value. All methods are public.
3. Case: 03
Draw the Class notation for Class Named ' Product '.
There are:
1. Association:
An association represents a bi-directional relationship between two classes. It
indicates that instances of one class are connected to instances of another class.
Example:
A department is associated with the college.
Directed Association:
In a directed association, an arrowhead is added to the association line
to indicate the direction of the relationship. The arrow points from the
class that initiates the association to the class that is being targeted or
affected by the association.
Example:
A “Teacher” class is associated with a “Course” class in a university
system. The directed association arrow may point from the “Teacher”
class to the “Course” class, indicating that a teacher is associated with
or teaches a specific course.
2. Aggregation:
A special type of association. It represents a "part of" relationship.
Example 1:
The company encompasses a number of employees, and even if one employee
resigns, the company still exists.
Example 2:
3. Composition:
The composition is a subset of aggregation. It portrays the dependency between
the parent and its child, which means if one part is deleted, then the other part
also gets discarded. It represents a whole-part relationship.
Example:
A contact book consists of multiple contacts, and if you delete the contact book,
all the contacts will be lost.
4. Generalization (Inheritance):
A generalization is a relationship between a parent class (superclass) and a child
class (subclass). In this, the child class is inherited from the parent class.
Example:
The Current Account, Saving Account, and Credit Account are the generalized
form of Bank Account.
5. Realization (Interface Implementation):
This as the relationship between the interface and the implementing class.
Example:
The Owner interface might specify methods for acquiring property and disposing of
property. The Person and Corporation classes need to implement these methods, possibly in
very different ways.
6. Dependency:
A dependency is a semantic relationship between two or more classes where a
change in one class cause changes in another class. It forms a weaker
relationship.
Example:
The In the following example, Student_Name is dependent on the Student_Id.
Multiplicity
It defines a specific range of allowable instances of attributes. In case if a
range is not specified, one is considered as a default multiplicity.
Example:
One company will have one or more employees, but each employee works for
one company only.
Multiplicity Indicator
Relationship Names
Names of relationships are written in the middle of the association line.
Good relation names make sense when you read them out loud
Example:
They often have a small arrowhead to show the direction in which direction to read the
relationship, e.g., expressions evaluate to values, but values do not evaluate to
expressions.
ReportDetailsForm 1 Of f endersDBProxy
<<boundary >> 1 <<boundary >>
Of f endersDB
EditReportController
<<control>>
Clerk
A building is owned by one person. A person may own more than one
building. Each building is either a house or an apartment. An apartment
contains two or more Rental Units. It is possible to buy a house, and rent or
vacate a Rental Unit
Case: 02
A company has one or more divisions. A division has one or more
departments. A company can have one or more persons working as
employees. A person is associated with the company as an employee. A
department can have one or more persons assigned to it. A person is assigned
to one department.
Case: 03
The library contains books and journals. It may have several copies of a given
book. Some of the books can be reserved for short-term loans and others for
long-term. Member of library can borrow books. There is a special type of
member- Member of Staff, who can borrow the journals. The system must keep
track of when books and journals are borrowed.
Case: 04
A system is required to manage customers, and their orders. Customers can place orders
for products. One customer can place as many orders as they wish; one order can be placed
by minimum 1 or maximum 2 customers. One order must include at least one product.
One product may be included in many orders. The organization sells two types of products
- readymade and customized. A readymade product is sold as it is bought from the
supplier. A customized product is made of at least 2 readymade products. One readymade
product can be bought from many suppliers. One supplier can sell many readymade
products. The organization has two types of customers-regular and priority. Priority
customers can also book products. Every booking is identified by a booking ID. There are
also booking date and expiry date attributes for every booking.
Case: 05
A Students may attend any number of courses. Every course may have any
number of students. Instructors teach courses. For every course there is at least
one instructor. Every instructor may teach zero or more courses. A school has
zero or more students. Each student may be a registered member of one or more
schools. A school has one or more departments. Each department belongs to
exactly one school. Every instructor is assigned to one or more departments.
Each department has one or more instructors. For every department there is
exactly one instructor acting as the department chair.
Case: 06
A hockey league made of at least four hockey teams. A hockey team can consist
of 6 to 12 players. Players have a captain who leads the hockey team. Players and
hockey teams have statistics. Hockey teams play games against each other. A
referee controls the game. At the end of each match, a player is announced as Man
of the Match. A coach trains the hockey team. A coach may train one or more
hockey team. The Coach, players and referees are people.
MCQ Practice
A hockey league made of at least four hockey teams. A hockey team can consist
of 6 to 12 players. Players have a captain who leads the hockey team. Players
and hockey teams have statistics. Hockey teams play games against each other.
A referee controls the game. At the end of each match, a player is announced as
Man of the Match. A coach trains the hockey team. A coach may train one or
more hockey team. The Coach, players and referees are people.
a) Association c) Aggregation
b) Composition d) Dependency
a) Association c) Aggregation
b) Composition d) Generalization
a) Association c) Aggregation
b) Composition d) Generalization
a) Association c) Aggregation
b) Composition d) None
a) Association c) Aggregation
b) Generalization d) None
6. The Relationship between hockey teams and captain is:
a) Association c) Aggregation
b) Generalization d) None
a) Attributes c) Operations
b) Object d) Stereotype
11. In Which of the following phases of RUP the least amount of Testing is
Carried out?
a) Inception c) Elaboration
b) Construction d) Transition
12. Which one of the following is not part of a Static Diagram?
a) Association c) Interaction
b) Generalization d) Aggregation
a) Inception c) Elaboration
b) Construction d) Transition
14. In UML, Which of the following type of visibility allows access only inside the
class?
a) Public c) Protected
b) Private d) Packaged
a) Association c) Aggregation
b) Composition d) Generalization
b) Interaction d) Component
a) Association c) Aggregation
b) Composition d) Generalization
20. Value of an attribute that remains same for all the object of a class is known as:
a) Attributes c) Operations
b) Object d) Stereotype
28. Which of the following relationship is not found in a use case diagram?
a) Association c) Realization
b) Dependency d) Generalization
a) Behavior c) Things
b) Relationship d) None
32. Value of an attribute that remains same for all the object of a class is known as:
33. Which of the following statement is correct based on the above diagram?
34. Which of the following statement is correct based on the above diagram?
a) A blade is not a part of any fan c) A blade must belong exactly one fan
a) Association c) Realization
b) Dependency d) Generalization
37. Which of the following is a behavioral thing that focuses on the lifeline of the
object?
b) Interaction d) Component
38. Which of the following a Class?
b) Interface d) Association
40. Qualified association in the class diagram indicates a qualifier to be used for:
a) Inheritance c) Indexing
b) Interaction d) Instantiation
a) Behavior c) Things
b) Relationship d) None
42. Which of the following statement is correct based on the above diagram?
a) A car contains maximum 4 tires c) A tire must belong to exactly one car.
and minimum 1 tire
b) A car contains minimum 4 tires d) A tire may belong to maximum one car
or more. Or no car at all.
Match the notation of next 4 question with the item in following list:
Match the notation of next 4 question with the item in following list:
True/False Practice
7. The maximum multiplicity of the association at the whole side can be more
than one in case of composition. must be one
11. Dependency relationships in use case diagram are of two types - include and
exclude
12. Behavioral things address mostly the dynamic part of the system.
15. Structural things address mostly the runtime environment of the system.
Runtime envieronment is use for Behavioral things
16. Relationship is prerequisite of interaction. Interaction is the prerequisite of Relationship
19. Relationship among actors is identified using association in a use case diagram
20. In a use case diagram, a system can be an actor of another system.
21. Include dependency relationship in a use case diagram is denoted for optional
condition. common condition
22. Structural things address mostly the dynamic part of the system. static part
24. The minimum multiplicity of the association at the whole side can be zero in
case of composition.