Podcast
Questions and Answers
What is the primary focus of procedural-oriented design?
What is the primary focus of procedural-oriented design?
- Data structures
- Functions (correct)
- Objects
- Inheritance
Which of the following is NOT a disadvantage of procedural-oriented design?
Which of the following is NOT a disadvantage of procedural-oriented design?
- Efficient use of memory (correct)
- Difficult to understand and maintain
- Difficult to modify and extend
- Data is not protected
What is the purpose of a constructor in object-oriented design?
What is the purpose of a constructor in object-oriented design?
- To inherit properties from another class
- To define the attributes of a class
- To initialize an object (correct)
- To destroy an object
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?
Which of the following object-oriented design principles allows for code reusability?
Which of the following object-oriented design principles allows for code reusability?
What does the term 'abstraction' refer to in object-oriented design?
What does the term 'abstraction' refer to in object-oriented design?
Which of the following is NOT a key task in detailed design?
Which of the following is NOT a key task in detailed design?
What is the purpose of internal component design in detailed design?
What is the purpose of internal component design in detailed design?
What is the primary purpose of using virtual functions in C++?
What is the primary purpose of using virtual functions in C++?
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?
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?
What is the primary benefit of using encapsulation in object-oriented programming?
What is the primary benefit of using encapsulation in object-oriented programming?
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)?
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?
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?
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?
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?
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?
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?
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?
How does overloading contribute to object-oriented design principles?
How does overloading contribute to object-oriented design principles?
Flashcards
Procedural-oriented design
Procedural-oriented design
A programming paradigm focused on functions and a sequence of instructions.
Object-oriented design
Object-oriented design
A programming paradigm that uses objects and classes to structure software.
Class
Class
A syntactic unit in OOP used to define objects, containing properties and methods.
Constructor
Constructor
Signup and view all the flashcards
Destructor
Destructor
Signup and view all the flashcards
Attribute
Attribute
Signup and view all the flashcards
Abstraction
Abstraction
Signup and view all the flashcards
Inheritance
Inheritance
Signup and view all the flashcards
Run-time polymorphism
Run-time polymorphism
Signup and view all the flashcards
Virtual function
Virtual function
Signup and view all the flashcards
Method overriding
Method overriding
Signup and view all the flashcards
Encapsulation
Encapsulation
Signup and view all the flashcards
Object-oriented design (OOD)
Object-oriented design (OOD)
Signup and view all the flashcards
Polymorphism
Polymorphism
Signup and view all the flashcards
Compile time polymorphism
Compile time polymorphism
Signup and view all the flashcards
Code reusability
Code reusability
Signup and view all the flashcards
Code modularity
Code modularity
Signup and view all the flashcards
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.