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.
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 answerHide 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
| Participant | Role |
|---|---|
| Customer | Initiates the order |
| Web/App Interface | Front-end system |
| Order Management System | Processes and manages orders |
| Restaurant System | Receives and prepares the order |
| Payment Gateway | Handles online payment |
| Bank/Card System | Authorizes 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
| Message | From | To |
|---|---|---|
login() | Customer | UI |
browseMenu() | Customer | UI |
placeOrder() | Customer | UI |
createOrder() | UI | Order System |
sendOrderDetails() | Order System | Restaurant |
initiatePayment() | UI | Payment Gateway |
requestAuth() | Payment Gateway | Bank |
authSuccess() | Bank | Payment Gateway |
paymentConfirmed() | Payment Gateway | Order System |
orderConfirmation() | UI | Customer |
notifyRestaurant() | Order System | Restaurant |
deliveryStatus() | Order System | Customer |
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.
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]
2079 · 10 marks
Compare structured development with object-oriented development. Explain use case diagram and class diagram with suitable example.[10]
2078 · 5 marks
What is class diagram? Explain class diagram with suitable example. [5]
Show solved answerHide 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
+-------------------------+
| Component | Description |
|---|---|
| Class Name | Name of the class (e.g., Student, Course) |
| Attributes | Properties or data members of the class |
| Operations | Methods or functions the class can perform |
| Associations | Relationships 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, andaddress, and operations likeenroll()andgetDetails(). - Course class has attributes like
courseID,courseName, andcredits, and operations likeaddStudent()andgetCourseInfo(). - 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
- Provides a static view of the system structure.
- Helps in identifying relationships (association, inheritance, aggregation) between classes.
- Serves as the foundation for object-oriented design and implementation.
- Useful for both forward engineering (design to code) and reverse engineering (code to design).
Basic Characteristics of Object-Oriented Systems
2076 · 5 marks
What is object-oriented development? How is it different from structured development? [5]
Make Unit 6 stick
Practice CSC326 with flashcards & quizzes