OOAD

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

Contents

CHAPTER ONE: USE CASE DIAGRAM............................................................................................................2


1.1 Introduction of Use Case..............................................................................................................2
1.2 Why use case?...................................................................................................................................2
1.3 Components of use case diagram......................................................................................................2
1.4 Relationship Between Use Cases:......................................................................................................2
1.5 Use case of Online food ordering system...........................................................................................3
CHAPTER TWO: ACTIVITY DIAGRAM............................................................................................................4
2.1 Introduction of Activity Diagram........................................................................................................4
2.2 Component of Activity Diagram.........................................................................................................4
2.3 Activity diagram of Online food ordering system...............................................................................5
CHAPTER THREE: CLASS DIAGRAM..............................................................................................................6
3.1 Introduction of Class Diagram............................................................................................................6
3.2 Class Relationships.............................................................................................................................6
3.3 Class diagram example of Online food ordering system....................................................................7
CHAPTER FOUR: SEQUENCE DIAGRAM........................................................................................................8
4.1 Introduction of Sequence Diagram....................................................................................................8
4.2 Components of Sequence Diagram....................................................................................................8
4.3 Sequence diagram example of Online food ordering system.............................................................9
CHAPTER FIVE: MAPPING DESIGN TO CODE..............................................................................................10
6.1 Introduction to Mapping Design to Code.........................................................................................10
CHAPTER ONE: USE CASE DIAGRAM

1.1 Introduction of Use Case


 Use case diagram is a visual representation of the interactions between users (actors) and a system.
It shows the different ways that actors can interact with the system to achieve specific goals. Use
case diagrams are a type of UML (Unified Modeling Language) diagram, which is a standard way of
representing software systems.

1.2 Why use case?


Use cases are prevalent in various fields, especially software development, to map out how a system
functions from a user's perspective. Here's a breakdown of why use cases are important:
a. Clarify User Interactions: Use cases detail the steps a user (or "actor") takes to accomplish a goal
using the system. This helps identify the functionalities required and ensures the system caters
to user needs.
b. Define System Requirements: By outlining user interactions, use cases aid in specifying the
functionalities a system must possess. This serves as a blueprint for developers to design and
build the system.
c. Manage Project Scope: Use cases help establish clear boundaries for the project. By
understanding specific user goals, developers can prioritize features and avoid scope creep.
d. Identify Potential Issues: Use cases often include alternative scenarios, such as errors or
unexpected inputs. This helps anticipate potential problems and design the system to handle
them gracefully.
e. Improve Communication: Use cases provide a common language for developers, stakeholders,
and users. This fosters clear communication and ensures everyone is on the same page regarding
the system's functionalities.

1.3 Components of use case diagram

A. Actors: Actors are anything that interacts with the system, such as people, external systems, or
devices. Actors are represented by stick figures or icons.

B. Use cases: A set of scenarios that describes an interaction between a actor and a system. Use cases
are represented by Oval.

C. System Boundary: Rectangle diagram representing the boundary between the actors and the
system.

1.4 Relationship Between Use Cases:


Relationships show how actors and use cases are connected. Its types are:
i. include: Represents the inclusion of the functionality of one-use case within another.
Dotted line with an open arrow is drawn from the base use case to the used use case.
Write << include >> above arrowhead line.

ii. Extend: Represents the extension of the use case to include optional functionality. Dotted
line with an open arrow is drawn from the extension use case to the base use case. Write
<< extend >> above arrowhead line

iii. Generalization: It is a relationship between a general use case and more specific use case
that inherits features in it. Shows as solid line with a hollow arrow point

1.5 Use case of Online food ordering system


CHAPTER TWO: ACTIVITY DIAGRAM

2.1 Introduction of Activity Diagram

 Activity diagram is basically a flow chart to represent the flow form one activity to another activity.
The control flow is drawn from one operation to another and this flow can be sequential, branched
or concurrent. This flow can be sequential, branched, or concurrent. Activity diagrams deal with all
type of flow control by using different elements such as fork, join, etc

2.2 Component of Activity Diagram


1. Start Node: Marked by a filled black circle, the start node indicates the beginning of the activity.
There can only be one start node per activity diagram.

2. Action or Activity: Represented by rounded-corner rectangles, actions signify the individual steps
or tasks performed within the activity.

Activity

3. Transmission (Flow): When the activity of a state completes, flow of control passes to the next
Action. Represented by arrow symbol
4. Join: Join and Fork have the same notation (either a horizontal or vertical bar). A black bar with
several flows entering in it and one leaving from it. Denoted the end of parallel activities

5. Fork: Beginning of the parallel activities


6. Decision: A diamond with one flow entering and several leaving. The flow leaving includes
conditions as TRUE/FALSE state.
7. Merge: A diamond with several flows entering and one leaving. The implication is that all
incoming flows to reach this point until processing continues
8. End Node: Represented by a hollow black circle, the end node signifies the completion of the
activity. Similar to the start node, an activity diagram typically has only one end node.

2.3 Activity diagram of Online food ordering system.


CHAPTER THREE: CLASS DIAGRAM

3.1 Introduction of Class Diagram

A class is a description of a set of objects that share the same attributes, operations, relationships, and
semantics • A class diagram is a diagram describing the structure of a system • Shows the system’s: –
Classes, Attributes, Methods and Relationship among classes

3.2 Class Relationships


 In UML, object interconnections (logical or physical), are modeled as relationships.
 Types: –
a. Dependencies: The dependency from CourseSchedule to Course exists because Course is
used in both the add and remove operations of CourseSchedule.

CourseSchedule

Course

add(c: Course)
remove (c:
Course

b. Generalization: A generalization connects a subclass to its superclass. It denotes an


inheritance of attributes and behavior from the superclass to the subclass and indicates a
specialization in the subclass of the more general superclass.
c. Associations: If two classes in a model need to communicate with each other, there must be
link between them. An association denotes that link.

teaches learns from


Student Instructor
1…* 1…*
*
membership
Student team
1…* 1…*

3.3 Class diagram example of Online food ordering system


CHAPTER FOUR: SEQUENCE DIAGRAM

4.1 Introduction of Sequence Diagram

 A sequence diagram is a type of interaction diagram that shows how processes operate with one
another and in what order. It is commonly used in software engineering to document and
understand the flow of messages and events in a system. Sequence diagrams are part of the
Unified Modeling Language (UML).

4.2 Components of Sequence Diagram


a. Actors: An actor in a UML diagram represents a type of role where it interacts with the system
and its objects. It is important to note here that an actor is always outside the scope of the
system we aim to model using the UML diagram.

Lifelines: A lifeline is a named element which depicts an individual participant in a sequence diagram. So
basically, each instance in a sequence diagram is represented by a lifeline. Lifeline elements are located
at the top in a sequence diagram.

a. Activation: Thick box over object's life line; drawn when object's method is on the stack
b. Message: Optionally indicated using a dashed arrow with a label indicating the return value.
Different arrowheads for normal/ concurrent (asynchronous) methods

i. Synchronous Message: Synchronous message requires a response before the


interaction can continue
ii. Asynchronous Message: Asynchronous message doesn’t need replay for interaction to
continue.

4.3 Sequence diagram example of Online food ordering system.


CHAPTER FIVE: MAPPING DESIGN TO CODE

6.1 Introduction to Mapping Design to Code


Implementation in an object-oriented language requires writing source code for:

 Class and interface definition


 Method definition

Design Class Di agrams contain class or interface names, classes, method and simple attributes. These
are sufficient for basic class definitions. Elaborate from associations to add reference attributes.

Example:

class ProductSpecification {

int price;

String description;

public ProductSpecification()

price=20;

description="good";

public int price()

{ return price;
}}

class SalesLineItem

{ int quantity;

public SalesLineItem(int q)

quantity=q;

public int subTotal()

ProductSpecification p= new ProductSpecification();

int p1=p.price;

int st= p1*quantity;

return st;

}}

class Sale

public int total()

SalesLineItem s= new SalesLineItem(7);

int t=s.subTotal();

return t;

}}

public class User

public static void main(String[] args)

Sale s =new Sale();

System.out.println(s.total());

}}

You might also like