Object Oriented Analysis and Design Lecture 02 PDF
Document Details
Uploaded by GoldenRealism
Saegis Campus
Ms. Chathurangi Dhanushika Weerasinghe
Tags
Summary
This document is a lecture on Object-Oriented Analysis and Design (OOAD) Principles. It covers the concepts of OOA and OOD, and discusses important concepts like abstraction, encapsulation, and modularity. The document also briefly discusses the benefits of using OOAD in software development, such as improved clarity in problem-solving, reusability, and maintainability.
Full Transcript
CS2101, SE2101, IT2101 Object Oriented Analysis and Design Lecture 02 Object-Oriented Analysis and Design (OOAD) Principles Bachelor of Science (Hons) in Computer Science | Software Engineering | Inf...
CS2101, SE2101, IT2101 Object Oriented Analysis and Design Lecture 02 Object-Oriented Analysis and Design (OOAD) Principles Bachelor of Science (Hons) in Computer Science | Software Engineering | Information Technology Department of Computing Faculty of Computing and Technology Saegis Campus Nugegoda Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 1 Object Oriented Analysis & Design Principles Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 2 What is OOAD? OOAD is a structured approach that uses object-oriented concepts to model and design software systems. Object-Oriented Analysis (OOA): Focuses on understanding the system requirements by modeling entities in the problem domain as objects. Object-Oriented Design (OOD): Transforms the analysis model into a design, specifying how these objects will interact and operate in the final system. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 3 Important! OOAD emphasizes reusability, scalability, and maintainability of software. Common in modern development methodologies such as Agile and Scrum. Aligns the software system closely with real-world entities, making it easier to understand and evolve. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 4 Agile Vs Scrum? VS Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 5 Steps in OOAD Process Requirement Gathering: Stakeholder interviews, user stories, and defining system goals. Ensures a shared understanding of what needs to be built. Object Identification: Objects are identified based on the system’s domain. Example: In a student registration system, objects like "Student“, "Course" and "Instructor" are identified. System Design: High-level architectural decisions are made, defining how objects interact. Example: Deciding that students can enroll in multiple courses and each course has multiple instructors. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 6 Steps in OOAD Process Class Design: Detailed design of each object’s internal structure (attributes, methods). Example: The "Student" class may have attributes such as name, student ID, and list of enrolled courses. Implementation: Writing code that adheres to the design. Example: Implementing the "enrollCourse()" method for a student object. Testing & Maintenance: Regular testing to ensure the system meets requirements. Ongoing maintenance and updates based on feedback and changes. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 7 What is OOA? OOA is the process of identifying and modeling real-world entities as objects in the software. Focuses on what the system must do (functional requirements) rather than how it will be done. Translates stakeholder requirements into models that can be easily understood. Objects identified during analysis are the foundation of design and implementation. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 8 Example: A Library System: Entities: Book, User, Librarian, Loan. Attributes: Book (title, author, ISBN), User (name, email), etc. Behavior: BorrowBook, ReturnBook, IssueLoan. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 9 Core OOA Principles/ Concepts Abstraction: Focus on important details, ignoring unnecessary complexities. Encapsulation: Data and methods are contained within objects, allowing access through defined interfaces. Modularity: Breaking down a large system into smaller, independent modules (objects). Hierarchy: Organizing objects using inheritance (is-a) and composition (has-a) relationships. Polymorphism: Objects of different types can be accessed through the same interface. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 10 Benefits of OOA in Software Development Clarity in Problem-Solving - OOA models the problem domain using objects that represent real-world entities, making it easier to understand and solve complex problems. Improved Reusability - Objects, once defined, can be reused across different applications or systems, saving time and effort in future projects. Ease of Communication - The object-oriented model is easy to explain to non-technical stakeholders because it mirrors real-world scenarios. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 11 Benefits of OOA in Software Development Maintainability - Changes in one part of the system (e.g., updating a "User" object) do not affect other parts, making the system easier to maintain and extend. Scalability - Systems built with OOA principles can easily grow by adding new objects or extending existing ones. Traceability - Objects in the system can be directly mapped to requirements and real- world entities, making it easier to trace functionality back to business requirements. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 12 What is Design Thinking? Design Thinking is a human-centered approach to innovation, integrating the needs of people, the possibilities of technology, and the requirements for business success. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 13 What is Design Thinking? Five Phases of Design Thinking: Empathize: Understand the user's needs through research. Define: Clearly articulate the problem based on user insights. Ideate: Brainstorm and generate creative solutions. Prototype: Create a prototype to test and explore the ideas. Test: Experiment with the prototype and refine based on feedback. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 14 Design Thinking - A Non-Linear Process? Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 15 Key points OOAD provides a structured approach to developing complex software systems. It allows for better communication between stakeholders, enhances system scalability, and simplifies future maintenance. The integration of design thinking ensures that the developed system aligns with user needs and delivers value. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 16 In class activity 01: Identify Objects and Classes Imagine you are designing a system for a university course registration system. Identify 3-5 objects you would need to represent in the system. For each object, list at least two attributes and two methods. Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 17 In class activity 02: Class Hierarchy Exercise Design a class hierarchy for a Vehicle Management System. What would be a suitable superclass? Define two subclasses and show how they inherit from the superclass. What attributes or methods are unique to the subclasses? Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 18 In class activity 03: Analyze OOA Principles Match the correct OOA principle to the scenario. Which OOA principle does the following describe? 1. You want to simplify the representation of a house by focusing only on its color, size, and number of rooms, while ignoring the detailed blueprints. 2. A user cannot directly change the balance of their bank account; they can only deposit or withdraw money through defined methods. Which principle is this? Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 19 In class activity 03 (Cont.): Analyze OOA Principles 3. A developer wants to divide a large e-commerce system into smaller parts like "Shopping Cart," "Product Catalog," and "User Profile." Which principle applies here? 4. A "Dog" and "Cat" class both inherit from the "Animal" class, and they both have a makeSound() method but each implementation is different. What principle is this? Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 20 Ms. Chathurangi Dhanushika Weerasinghe, MSc UCSC(Col), BSc (Ruh) Saegis Campus 21