Podcast
Questions and Answers
What is the primary focus of procedural-oriented design?
What is the primary focus of procedural-oriented design?
Which of the following is NOT a disadvantage of procedural-oriented design?
Which of the following is NOT a disadvantage of procedural-oriented design?
What is the purpose of a constructor in object-oriented design?
What is the purpose of a constructor in object-oriented design?
What is the relationship between a class and an object in object-oriented design?
What is the relationship between a class and an object in object-oriented design?
Signup and view all the answers
Which of the following object-oriented design principles allows for code reusability?
Which of the following object-oriented design principles allows for code reusability?
Signup and view all the answers
What does the term 'abstraction' refer to in object-oriented design?
What does the term 'abstraction' refer to in object-oriented design?
Signup and view all the answers
Which of the following is NOT a key task in detailed design?
Which of the following is NOT a key task in detailed design?
Signup and view all the answers
What is the purpose of internal component design in detailed design?
What is the purpose of internal component design in detailed design?
Signup and view all the answers
What is the primary purpose of using virtual functions in C++?
What is the primary purpose of using virtual functions in C++?
Signup and view all the answers
Which of the following features of object-oriented design is closely related to the concept of hiding data within a class?
Which of the following features of object-oriented design is closely related to the concept of hiding data within a class?
Signup and view all the answers
In the context of object-oriented design, how does abstraction differ from encapsulation?
In the context of object-oriented design, how does abstraction differ from encapsulation?
Signup and view all the answers
What is the primary benefit of using encapsulation in object-oriented programming?
What is the primary benefit of using encapsulation in object-oriented programming?
Signup and view all the answers
Which of the following is a key difference between procedural-oriented design (POD) and object-oriented design (OOD)?
Which of the following is a key difference between procedural-oriented design (POD) and object-oriented design (OOD)?
Signup and view all the answers
Which benefit of object-oriented design (OOD) allows for the creation of new objects based on existing ones, promoting code reuse?
Which benefit of object-oriented design (OOD) allows for the creation of new objects based on existing ones, promoting code reuse?
Signup and view all the answers
What is the key principle of object-oriented design (OOD) that hides unnecessary complexity and presents only essential features of an object?
What is the key principle of object-oriented design (OOD) that hides unnecessary complexity and presents only essential features of an object?
Signup and view all the answers
Which of the following features of object-oriented design (OOD) refers to the ability of a programming language to treat objects differently based on their class or data type?
Which of the following features of object-oriented design (OOD) refers to the ability of a programming language to treat objects differently based on their class or data type?
Signup and view all the answers
Which type of polymorphism occurs during the compilation process, binding function calls with specific implementations at compile time?
Which type of polymorphism occurs during the compilation process, binding function calls with specific implementations at compile time?
Signup and view all the answers
What is the main advantage of using abstract classes in object-oriented design?
What is the main advantage of using abstract classes in object-oriented design?
Signup and view all the answers
What does the term 'polymorphism' mean in the context of object-oriented programming?
What does the term 'polymorphism' mean in the context of object-oriented programming?
Signup and view all the answers
Which of the following is NOT a benefit of using object-oriented design (OOD) principles?
Which of the following is NOT a benefit of using object-oriented design (OOD) principles?
Signup and view all the answers
How does overloading contribute to object-oriented design principles?
How does overloading contribute to object-oriented design principles?
Signup and view all the answers
Study Notes
CP317 Software Engineering - Low-level Design (Part 2)
- Course information: CP317 Software Engineering, low-level design, part 2, week 4-2. Instructor: Shaun Gao, Ph.D., P.Eng.
Agenda
- Review of week 4-1 topics
- Introduction to procedural-oriented design
- Introduction to object-oriented design
- Abstraction
- Inheritance
- Polymorphism
- Encapsulation
- Comparison of procedural-oriented design vs. object-oriented design
- Summary
Review of Week 4-1 Topics
- Low-level (detailed) design concepts
- Key tasks in detailed design: understanding requirements, architecture, and systems
- Detailed design creation: interface design (internal/external), shared memory, inter-process communication (IPC)
- Graphical User Interface (GUI) design
- ASCII table use
- Internal component design: structural & behavioral aspects
- Data design and data structure design for detailed design
- Documentation and evaluation of detailed design
Introduction to Procedural-Oriented Design
- Primary focus: functions
- Step-by-step approach that guides applications through instruction sequences
- Instructions executed in a specific order
- Data structure: global and local data
- Diagram shows the flow of control within a procedural-oriented program
Procedural-Oriented Design Disadvantages
- Data protection: data is not protected from unwanted access
- Modification issues: adding new data requires modifying all functions accessing it
- Modeling real world problems: less effective at representing real-world issues
- Complexity & Scalability: becomes problematic when size/complexity increase; difficulties with modification/extension → lacks scalability
- Vulnerability: easier to break (vulnerable) due to lack of proper structure
Introduction to Object-Oriented Design
- Classes: units defining objects (with properties/methods)
- Constructor: special method initializing objects (a class usually has default constructor)
- Destructor: special method automatically called when objects are destroyed (a class usually has default destructor)
- Attributes: properties of a class (things that can be measured or observed)
Object-Oriented Design (cont.)
- Objects: created from classes via constructors (matched parameter types)
- Relationship: between classes and objects
Object-Oriented Design (cont.)
- History of Object-oriented design: data -> methods
- Object orientation combines data & methods into classes (cohesive wholes)
- Object-Oriented Design (OOD): A process of designing interacting objects for software problem-solving
- Comparison: Procedural-oriented design vs. Object-oriented design
Object-Oriented Design (cont.)
- Features: Abstraction, Inheritance, Polymorphism, Encapsulation
- Benefits: code reusability (new objects from old), code modularity (object-based), easier maintenance, design stability
Abstraction
- Hiding unnecessary details and showing essential object features
- No implementation details, just the concept
- Benefits: reduced complexity and improved maintainability
- Examples: abstract classes (declaring pure virtual member function in C++)
Inheritance
- Mechanism for derived classes to acquire properties from a base class
- Benefits: increased productivity through code reuse and easier maintenance
Polymorphism
- Method naming consistency across various object data types (or class)
- Polymorphism enables different behaviours depending on specific data types
- Benefits: Code reuse and improved flexibility
- Support different types of function calls
Compile Time Polymorphism (Static Binding)
- Binding is done during compile time
- In C++, non-virtual functions are bound during compile time
Run Time Polymorphism (Dynamic Binding)
- Binding occurs during runtime
- C++ uses virtual functions for run-time polymorphism
Overloading
- Technique allowing functions with the same name but different parameters for different behaviours within a class
- Why Overloading is needed: allows greater flexibility in handling various data types or input sequences
- Examples of Function Overloading
Overriding
- Function definition in a subclass that matches a method defined in a superclass
- Method overrides offer custom implementation
- Examples of Function Overriding
Encapsulation
- Hiding internal object characteristics and functionality (prevent outside modifications; users only see appropriate interfaces through public methods)
- Benefits: improved software reliability, easier maintenance, reusability
- Examples: setter(...) and getter() methods for accessing data elements inside an object
Abstraction vs. Encapsulation
- Abstraction: implementation hiding via abstract classes/interfaces
- Encapsulation: data hiding via access modifiers (public, private, protected)
POD vs. OOD
- Procedural vs. Object-Oriented Programming
- Procedural Programming
- Global data
- General function
- Local data (variables)
- Object-Oriented Programming
- Objects
- Properties
- Methods
- Objects
POD vs. OOD (Advantages/Disadvantages)
- Procedural Programming (Advantages): code reusability, program flow tracking, module construction
- Procedural Programming (Disadvantages): global data vulnerability, complex data verification, difficult real-world modelling
- Object-Oriented Programming (Advantages): task partitioning (in projects), secure programs (using data hiding), object categorizing/mapping, flexible code upgrade/enhancement through inheritance, eliminate redundant code, greater modularity, data abstraction enhances reliability, flexible dynamic binding
- Object-Oriented Programming (Disadvantages): more resources required, complex behaviour & debugging, tight coupling in inheritance, message passing affects reusability
Think-Pair-Share
- Group projects: which OOP features can be utilized
Summary
- Procedural-oriented design
- Object-oriented design
- Abstraction (concept)
- Inheritance (concept)
- Polymorphism (concept)
- Encapsulation (concept)
- Differences between POD and OOD
Announcement
- Group formation deadline
- Test 1 details (60 min, cover week 1-4 material), upcoming date, location (LH3094). Students need their laptops.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers key concepts related to low-level design as part of the CP317 Software Engineering course. It focuses on procedural-oriented design, object-oriented design principles such as abstraction, inheritance, polymorphism, and encapsulation. Additionally, it compares these design paradigms and summarizes essential topics from previous weeks.