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

21
Software Design FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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

Software Design

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

Software Design Process

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

Software Design Process■ Software design provides interaction between requirements and implementation

■ Software design process is a problem solving process1. Understand the problem2. Identify one or more solutions3. Create abstractions (model diagrams) for the identified solution4. Refine the each abstraction

■ Software design process is refined through different stages1. Informal design outline2. Informal design3. Formal design4. Finished (final) design

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

Software Design Quality Attributes

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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 individualmodules 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

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

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

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

Design Objectives

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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

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

Object Oriented Design(Classes & Objects)

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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 ofoperations (behaviors or methods) which operate on that state.

■ Class is a blueprint or template definition for an object which create objects anddefine 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

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

Object Oriented Design(Attributes & Behavior)

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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

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

Object Oriented Design(Relations among Classes & Objects)

(Association, Aggregation & Composition)

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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

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

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 canexist 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

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

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 thelifecycle 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 Bcannot 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

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

Object Oriented Design(Inheritance)

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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 childclass) 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 hierarchy of classes

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

Object Oriented Design(Polymorphism)

FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

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

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 ofclasses related by inheritance

1. Parent class (generalization) is extended by specific child classes (specialization)2. Child classes override the behaviors (methods) of parent class3. 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

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

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