2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)

  • View
    321

  • Download
    1

Embed Size (px)

Text of 2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)

  1. 1. Software Design FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  2. 2. Software Design Process FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  3. 3. Software Design Process Software design provides interaction between requirements and implementation Software design process is a problem solving process 1. Understand the problem 2. Identify one or more solutions 3. Create abstractions (model diagrams) for the identified solution 4. Refine the each abstraction Software design process is refined through different stages 1. Informal design outline 2. Informal design 3. Formal design 4. Finished (final) design FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  4. 4. Software Design Quality Attributes FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  5. 5. Software Design Quality Attributes Abstraction Generalization by reducing the information content of a concept Retain only relevant information Easier to understand the concept without dealing with unnecessary details Modularity Software is divided into different components called modules Degree to which a system's components can be separated and recombined Structural organization containing individual modules and their interconnections Cohesion (High or Low) Degree to which the elements of a module belong together Concerns relationships within a module FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  6. 6. Software Design Quality Attributes Coupling (Loose or Tight) Degree of interdependence between modules Concerns relationships between modules Information Hiding Hide irrelevant details of a module (Abstraction) Module contains related functionality (High Cohesion) Modules are independent (Loose Coupling) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  7. 7. Design Objectives FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  8. 8. Design Objectives Correctness Full fill all requirements Implement every constraint Efficiency Proper management of resources Maximize performance Cost Minimize cost Maintainability Facilitate debugging and testing Easy to modify and extend FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  9. 9. Object Oriented Design (Classes & Objects) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  10. 10. Classes & Objects Object is an entity in a software system which represent an instance of a thing from real-world. It has a state (set of attributes or properties) and a defined set of operations (behaviors or methods) which operate on that state. Class is a blueprint or template definition for an object which create objects and define their state and operations. Class is a type and object is an instance. Object-Oriented design Approach of software design Identify problem domain objects and represent them with classes Define the classes and relationships between their objects Create system of interacting objects to solve a problem FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  11. 11. Object Oriented Design (Attributes & Behavior) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  12. 12. Attributes & Behaviors Class defines the attributes and behaviors for the objects Attributes (properties) define the data in an object Describe the state of an object Represented by variables in an object Behaviors (methods) define the functionality of an object Describe how object responds to messages passed to it Represented by functions of an object FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  13. 13. Object Oriented Design (Relations among Classes & Objects) (Association, Aggregation & Composition) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  14. 14. Association Association is a relationship or a connection between two classes where there is no owner and all objects have their own lifecycle Removing the objects does not change the lifecycle of their related objects Association relation between two classes A and B can be defined when A uses B A knows B A is related to B Association multiplicity between two classes can be defined as One-to-one (one object of class is related to exactly one object of other class) One-to-many (one object of class is related to multiple objects of other class) Many-to-many (Multiple objects of class are related to multiple objects of other class) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  15. 15. Aggregation Aggregation is a special type of Association where there is an ownership relation (one class owns the other class) but all objects have their own lifecycle Removing the owned objects does not change the lifecycle of their owner objects Removing the owner objects does not change the lifecycle of their owned objects Aggregation relation between two classes from A to B can be defined when B can exist without A and A has a B A consists of B A owns B B belongs to A B is a part of A FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  16. 16. Composition Composition is a special type of Aggregation where there is an ownership relation (one class owns the other class) and lifecycle of owned objects depend on the lifecycle of their owner objects Removing the owned objects does not change the lifecycle of their owner objects Removing the owner objects also ends the lifecycle of their owned objects Composition relation between two classes from A to B can be defined when B cannot exist without A and A has a B A consists of B A owns B B belongs to A B is a part of A FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  17. 17. Object Oriented Design (Inheritance) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  18. 18. Inheritance Inheritance is a relationship or a connection between two classes where one class extends an existing class and inherit all the characteristics of existing class Inheritance relation between two classes from A (sub class, derived class or child class) to B (super class, base class or parent class) can be defined when A is a B A is kind / type of B A is like B Child class can implement its own attributes and behaviors Child class can access the attributes and behaviors of its parent class Child class can override the behaviors of its parent class Class can also extend an already extended class, creating a hierarchyof classes FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  19. 19. Object Oriented Design (Polymorphism) FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  20. 20. Polymorphism Polymorphism provides different implementation of behaviors (methods) that are implemented with same name Static polymorphism occurs due to behavior (method) overloading in same class Dynamic polymorphism occurs due to behavior (method) overriding in a hierarchy of classes related by inheritance 1. Parent class (generalization) is extended by specific child classes (specialization) 2. Child classes override the behaviors (methods) of parent class 3. Behaviors (methods) are invoked depending on the child class of the object FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  21. 21. Reference Using UML: Software Engineering with Objects and Components by Perdita Stevens, Rob Pooley, Addison-Wesley, 2006 FROM: HAFIZ AMMAR SIDDIQUI COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY