6 Introduction To Object Oriented Development

System Analysis and Design · Unit 6 · 6 hrs

Introduction to Object-Oriented Development

Exam-focused notes for Introduction to Object-Oriented Development (System Analysis and Design, CSC326): what the TU syllabus asks and how it has actually been tested, with 6 solved past questions from this unit.

Introduction to Object-Oriented Development in short

Object-oriented development reframes analysis and design around objects rather than processes and data taken separately, and this chapter introduces its core concepts and the Unified Modeling Language used to express them.

Introduction to Object-Oriented Development: notes

Basic Characteristics of Object-Oriented Systems

A class is a collection of similar objects, objects that share the same data structure and behaviour; it defines the attributes and operations common to its objects but, on its own, is only a template, not an object. Classes are built through abstraction: a set of similar real-world things is observed and their common characteristics listed, with the level of abstraction chosen depending on the application; data abstraction specifically means exposing only the information the outside world needs while hiding implementation detail. Inheritance lets objects of one class acquire the properties of objects of another class, sharing characteristics with the class it is derived from. Polymorphism is the ability of an operation to take more than one form, so the same operation can behave differently in different instances. Reusability means a class, once defined, can be used again and again simply by creating further objects of its type. Data hiding insulates an object's data from direct access by other parts of the program, separating its internal workings from how it is used externally.

Object-Oriented System Analysis and Design (OOSAD)

Object-oriented analysis examines a system's requirements from the perspective of the classes and objects that appear in the vocabulary of the problem domain, rather than from separate process and data views. Object-oriented design then produces the logical and physical, static and dynamic models of the system being built. Compared with conventional structured analysis and design, object-oriented modelling brings the benefits of inheritance, reusability, data hiding and polymorphism directly into the analysis and design models themselves, not only into the eventual code.

What this unit covers

  • Basic Characteristics of Object-Oriented Systems
  • Object-Oriented System Analysis and Design (OOSAD)
  • Introduction to Unified Modeling Language, Structural and Behavioral Diagrams

Introduction to Unified Modeling Language, Structural and Behavioral Diagrams

2082 · 5 marks

Draw the sequence diagram for the online food ordering system with the online payment facility. [5]

Show solved answer

Sequence Diagram for Online Food Ordering System with Online Payment Facility


What is a Sequence Diagram?

A sequence diagram is a type of UML interaction diagram that shows how objects interact with one another and in what order (sequence) those interactions occur over time. It captures the dynamic behavior of the system.


Key Actors and Objects Involved

ParticipantRole
CustomerInitiates the order
Web/App InterfaceFront-end system
Order Management SystemProcesses and manages orders
Restaurant SystemReceives and prepares the order
Payment GatewayHandles online payment
Bank/Card SystemAuthorizes the transaction

Sequence Diagram (Textual Representation)

Customer      UI/App        OrderSystem     Restaurant     PaymentGateway    Bank
   |             |               |               |                |             |
   |--login()-->|               |               |                |             |
   |<--loginSuccess()--|        |               |                |             |
   |             |               |               |                |             |
   |--browseMenu()-->|          |               |                |             |
   |<--displayMenu()--|         |               |                |             |
   |             |               |               |                |             |
   |--selectItems()-->|         |               |                |             |
   |--placeOrder()-->|          |               |                |             |
   |             |--createOrder()-->|           |                |             |
   |             |               |--sendOrderDetails()-->|       |             |
   |             |               |<--orderConfirmed()----|       |             |
   |             |<--orderID + totalAmount()--|  |                |             |
   |             |               |               |                |             |
   |--selectPayment()-->|        |               |                |             |
   |--enterPaymentDetails()-->|  |               |                |             |
   |             |--initiatePayment()----------->|                |             |
   |             |               |               |--requestAuth()------------>|
   |             |               |               |                |<--authSuccess()--|
   |             |               |               |<--paymentConfirmed()--|     |
   |             |<--paymentSuccess()--|          |                |             |
   |<--orderConfirmation() + receipt()--|         |                |             |
   |             |               |               |                |             |
   |             |               |--notifyRestaurant()-->|        |             |
   |             |               |               |--prepareOrder()|             |
   |             |               |               |--dispatchOrder()|            |
   |<--deliveryStatus()----------|               |                |             |

Diagram Description (Step-by-Step)

Step 1: Login

  • The Customer logs into the system through the UI/App.
  • The system returns a login success message.

Step 2: Browse and Select Menu

  • Customer browses the menu; the UI fetches and displays menu items.
  • Customer selects items and adds them to the cart.

Step 3: Place Order

  • Customer clicks Place Order.
  • UI sends a createOrder() request to the Order Management System.
  • Order system forwards order details to the Restaurant System.
  • Restaurant confirms the order back to the Order System.
  • UI displays Order ID and total amount to the customer.

Step 4: Online Payment

  • Customer selects a payment method (card/wallet) and enters payment details.
  • UI calls initiatePayment() on the Payment Gateway.
  • Payment Gateway sends an authorization request to the Bank/Card System.
  • Bank verifies and returns authorization success.
  • Payment Gateway sends payment confirmed back to the Order System and UI.
  • Customer receives a payment success message and receipt.

Step 5: Order Fulfillment

  • Order System notifies the Restaurant to prepare the order.
  • Restaurant prepares and dispatches the order.
  • Customer receives real-time delivery status updates.

Summary of Lifelines and Messages

MessageFromTo
login()CustomerUI
browseMenu()CustomerUI
placeOrder()CustomerUI
createOrder()UIOrder System
sendOrderDetails()Order SystemRestaurant
initiatePayment()UIPayment Gateway
requestAuth()Payment GatewayBank
authSuccess()BankPayment Gateway
paymentConfirmed()Payment GatewayOrder System
orderConfirmation()UICustomer
notifyRestaurant()Order SystemRestaurant
deliveryStatus()Order SystemCustomer

Key Point for Exam: In a sequence diagram, vertical lines are called lifelines, horizontal arrows are messages, and activation boxes (rectangles on lifelines) show when an object is active/processing.

Open this answer on its own page →

2081 · 5 marks

Draw use case diagram and class diagram for the following scenario:The admin and user has to log in to the patient record system. The user can see details of its records but will not be able to make changes. The changes will be controlled by admin. The admin has authority to generate reports and send it to doctors and users. [5]

Actor Use Cases ------------------ User Login, View Own Records Admin Login, Manage/Update Records, Generate Reports, Send Reports to Doctors and Users Relationships: - Both User and Admin are associated with Login (using <<include) - Generate Report <<include Send Report - User can only View Rec...

Open this answer on its own page →

2080 · 5 marks

Explain class diagram with suitable example. [5]

A class diagram is a type of UML (Unified Modeling Language) structural diagram that consists of classes, interfaces, associations, and collaborations. It represents the object-oriented view of a system, which is static in nature. It is the building block of all object-oriented software systems a...

Open this answer on its own page →

2079 · 10 marks

Compare structured development with object-oriented development. Explain use case diagram and class diagram with suitable example.[10]

--- Structured development and object-oriented (OO) development are two major approaches to building information systems. Aspect Structured Development Object-Oriented Development --------- Basic Unit Functions/Procedures and data are separate Objects that combine data and behavior together Focus...

Open this answer on its own page →

2078 · 5 marks

What is class diagram? Explain class diagram with suitable example. [5]

Show solved answer

Class Diagram

Definition

A class diagram is a type of UML (Unified Modeling Language) structural diagram that consists of classes, interfaces, associations, and collaborations. It represents the object-oriented view of a system, which is static in nature. It is the building block of all object-oriented software systems and helps us identify relationships between different classes or objects.


Components of a Class Diagram

A class in a class diagram is represented as a rectangle divided into three compartments:

+-------------------------+
|      Class Name         |   <-- Top compartment
+-------------------------+
|      Attributes         |   <-- Middle compartment
+-------------------------+
|      Operations         |   <-- Bottom compartment
+-------------------------+
ComponentDescription
Class NameName of the class (e.g., Student, Course)
AttributesProperties or data members of the class
OperationsMethods or functions the class can perform
AssociationsRelationships between classes (shown by lines/arrows)

Example: Student and Course

+-------------------------+        enrolls in        +-------------------------+
|        Student          |--------------------------|        Course           |
+-------------------------+                          +-------------------------+
| - studentID: int        |                          | - courseID: int         |
| - name: String          |                          | - courseName: String    |
| - address: String       |                          | - credits: int          |
+-------------------------+                          +-------------------------+
| + enroll()              |                          | + addStudent()          |
| + getDetails()          |                          | + getCourseInfo()       |
+-------------------------+                          +-------------------------+

Explanation of the Example:

  • Student class has attributes like studentID, name, and address, and operations like enroll() and getDetails().
  • Course class has attributes like courseID, courseName, and credits, and operations like addStudent() and getCourseInfo().
  • The association between Student and Course shows that a student enrolls in a course, representing the relationship between the two classes.

Importance of Class Diagrams

  1. Provides a static view of the system structure.
  2. Helps in identifying relationships (association, inheritance, aggregation) between classes.
  3. Serves as the foundation for object-oriented design and implementation.
  4. Useful for both forward engineering (design to code) and reverse engineering (code to design).
Open this answer on its own page →

Basic Characteristics of Object-Oriented Systems

2076 · 5 marks

What is object-oriented development? How is it different from structured development? [5]

Object-Oriented (OO) development is an approach to systems analysis and design that examines and models a system from the perspective of classes and objects found in the problem domain. As stated in Object-Oriented System Analysis and Design (OOSAD): - Object-Oriented Analysis (OOA) examines requ...

Open this answer on its own page →