Software Engineering Week 4 Low Level Design P2 PDF
Document Details
Uploaded by HaleNeodymium
Wilfrid Laurier University
Shaun Gao
Tags
Summary
This document provides a summary of topics and concepts related to software engineering, including procedural-oriented design, object-oriented design, and low-level detailed design techniques.
Full Transcript
CP317 Software Engineering Low-level design – part 2 – week 4-2 Shaun Gao, Ph.D., P.Eng. Agenda Review week 4-1 topics Introduction Procedural-oriented design Object-oriented design Abstraction Inheritance Polymorphism Encapsulation Proced...
CP317 Software Engineering Low-level design – part 2 – week 4-2 Shaun Gao, Ph.D., P.Eng. Agenda Review week 4-1 topics Introduction Procedural-oriented design Object-oriented design Abstraction Inheritance Polymorphism Encapsulation Procedural-oriented design vs. object-oriented design Summary Review week 4-1 Low-level (detailed) design Concept Key tasks in detailed design Understanding requirements, architecture and systems Creating detailed design Interface design (internal and external) Shared memory, inter-process communication (IPC) Graphical User interface (GUI) design ASCII table/code Internal component design (structure and behavioral) Data design, data structure design Documenting detailed design Evaluating detailed design Introduction Procedural-oriented design the primary focus is on functions. Procedural-oriented design creates a step by step software that guides the application through a sequence of instructions. Each instruction is executed in a certain order. Introduction – cont. The disadvantages of procedural-oriented design The data is not protected If new data is added, all the functions need to be modified for accessing the data It does not model real world problems very well When software size becomes larger and more complex, the software becomes problematical such that Difficult to understand and maintain Difficult to modify and extend – lacks scalability Easy to break (vulnerable) Object-oriented design Classes A class is a syntactic unit used to define objects. A class usually contains properties, methods. Constructor A constructor is a special method of a class, which initializes an object. Default constructor Destructor A destructor is a special method of a class, which is automatically invoked when an object is destroyed. Default destructor Object-oriented design – cont. Attributes An attribute is the property of a class, which is a thing that can be measured or observed. Objects An object is created from a class, by using or invoking the constructor of the class with matching parameter types. Relationship between a class and objects Object-oriented design – cont. History: data methods Object orientation combines data and methods together into a cohesive whole class. Object-oriented design (OOD) OOD is the process of planning a system of interacting objects for the purpose of solving a software problem. Procedural-oriented design vs. object-oriented design Object-oriented design – cont. The features of object-oriented design Abstraction Inheritance Polymorphism Encapsulation The benefits of OOD Code reusability – new objects can be derived from old objects Code modularity – object based Easier maintenance Design stability Object-oriented design – cont. Abstraction Abstraction is a concept to hide unnecessary details and only show the essential features of the object. There is no implementation here its just a concept. Benefits of abstraction: Reduce the complexity Improve the maintainability Examples Abstract classes You can create an abstract class by declaring at least one pure virtual member function in C++ Object-oriented design – cont. Inheritance Inheritance is a mechanism in which derived classes acquire the property of a base class. Benefits of inheritance Increased productivity – code reuse Easier for maintenance Object-oriented design – cont. Polymorphism History: the name of a method is unique Polymorphism refers to a programming language’s ability to process objects differently depending on their data types or class. Polymorphism = many forms Benefits of polymorphism Code reuse – reusability Improves flexibility Help reducing coupling between different components Object-oriented design – cont. Two types of polymorphism Compile time polymorphism Run time polymorphism Compile time polymorphism Compile time binding or static binding In C++, all non-virtual functions are bound at compile time. Class TestA{ Public: functX(int num){ …… } functX(float dec, int num){……} functX( ){……} } Overloading: overloading is a technique that there are multiple functions or operators with the same name, but their parameters are different within a class. Why is overloading needed? Object-oriented design – cont. Run-time polymorphism = Run-time binding or dynamic binding Run-time binding is to associate a function’s name with the entry point at run time. C++ supports run-time binding through virtual function. Keyword virtual is used to declare a function is a virtual function. Derived classes have their own implementation of the virtual function, base class virtual functions are overridden in derived classes. Overriding: If a derived class defines the same function as defined in its base class, it is known as function overriding. Method overriding allows a derived class to provide a specific implementation of a method that is already provided by one of its parent classes. Object-oriented design – cont. An example of Function overloading Object-oriented design – cont. An example of Function overriding Object-oriented design – cont. Object-oriented design – cont. Object-oriented design – cont. Encapsulation Encapsulation is the hiding of information. It prevents users from seeing the internal working of an object Examples: Setter(…) and getter() Benefits of encapsulation Improves software reliability Easier for maintenance Reusability Object-oriented design – cont. Abstraction vs. Encapsulation Abstraction means- hiding implementation using abstract class and interfaces etc. Encapsulation means-hiding data like using getter and setter etc. POD vs. OOD POD vs. OOD Think – Pair – Share For group project, which OOP features can be used? Summary Procedural-oriented design Object-oriented design Abstraction Concept Inheritance Concept Polymorphism Concept Encapsulation Concept Differences between POD and OOD Announcement 75% of you have a group. Please find a group ASAP. Please let me know if you need help Test 1 (60 minutes, cover week 1 - week 4) on Feb. 3 class time. Please bring your laptop Locations: LH3094