Presentation is loading. Please wait.

Presentation is loading. Please wait.

Requirements Analysis 9. 1 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved INFO2005 Requirements Analysis Object.

Similar presentations


Presentation on theme: "Requirements Analysis 9. 1 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved INFO2005 Requirements Analysis Object."— Presentation transcript:

1 Requirements Analysis 9. 1 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved INFO2005 Requirements Analysis Object Oriented Concepts Department of Information Systems

2 Requirements Analysis 9. 2 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Learning Objectives v Why OO? v Classes & Objects v Review the UML notation v Some important concepts in OO

3 Requirements Analysis 9. 3 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Why OO? v Easier maintenance & extensibility of software v Supports reuse of existing software v Handles complexity well v Natural modelling (i.e. descriptions) of problem domain v Requirements traceability

4 Requirements Analysis 9. 4 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Objects An object is “a concept, abstraction or thing with crisp boundaries and meaning for the problem at hand.” Rumbaugh et al., 1991 An object reflects “the capabilities of a system to keep information [or] to interact” Coad and Yourdon, 1991 An object has “ state, behaviour and identity ” Booch, 1993 An object “represents a particular instance of a class. It has identity and attribute values” UML Spec V1.1

5 Requirements Analysis 9. 5 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Object State v Static and dynamic attributes v State is reflected by attribute values v A car object…. u make u model u mileage u dateRegistered u dateTaxed u dateTested may have states:

6 Requirements Analysis 9. 6 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Object Behaviour v We associate valid behaviour (operations) with each object v For the car object –register –tax –changeColour? v Each valid operation is invoked by a request from another object

7 Requirements Analysis 9. 7 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Object Identity v Object identity is intrinsic, not necessarily reflected by attribute values v Referenced by an object-id v Cars have different registrations but the registration is not the object id

8 Requirements Analysis 9. 8 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Classes Class describes “a group of objects with – Rumbaugh et al., 1991 Class is “a descriptor for a set of objects with similar structure & behaviour” UML V1.1

9 Requirements Analysis 9. 9 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Classification v Grouping objects with the same behaviour and data. v Modifying or Extending the object v Example

10 Requirements Analysis 9. 10 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Class Window {abstract, author=Ray, status=tested} +size:Area = (50,50) #visibility:Boolean=invisible +default-size:Rectange #maximum-size:Rectangle -xptr:XWindow* +display() +create() -attachXWindow(xwin:XWindow*) Window size:Area visibility:Boolean display() Implementation Detail Suppressed Analysis Level

11 Requirements Analysis 9. 11 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Message Passing v Objects collaborate to achieve the functional requirements v Objects communicate by passing messages –request – calls –may include parameters –some messages have

12 Requirements Analysis 9. 12 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Message Passing Borrower address name status Book status title borrow

13 Requirements Analysis 9. 13 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Encapsulation

14 Requirements Analysis 9. 14 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Encapsulation v An object has data and behaviour v Behaviour = v Data should be accessed only by object’s own operations v Operation signature specifies number and type of attributes passed to it

15 Requirements Analysis 9. 15 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Effect of Encapsulation v Object implementation hidden from other objects v Other objects see only operation protocols v Internal details may change significantly— no effect on rest of system v As long as operation purpose and protocol stay the same, changes don’t “ripple”

16 Requirements Analysis 9. 16 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved v But we want to distinguish academic and admin staff v E.g. admin staff can’t be assigned to teaching v We specialise the StaffMember base class Generalisation-Specialisation v Say we have a general Staff class:

17 Requirements Analysis 9. 17 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Generalisation-Specialisation

18 Requirements Analysis 9. 18 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Generalisation-Specialisation  Instances of AdminStaff and AcademicStaff all have name, address, phone, nextOfKin attributes v (from generalised StaffMember class)  AcademicStaff also has specialised associations with Module

19 Requirements Analysis 9. 19 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Inheritance v An example of inheritance v Gives opportunities for reuse v Minimises duplication of effort v Derived classes inherit base class reliability v Don’t violate base class encapsulation

20 Requirements Analysis 9. 20 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Inheritance  Subclasses redefine the operation pay  (signature stays the same) v Sender of message need not know class of receiving object v Inheritance allows reuse of existing class definitions v Just add extra attributes or modify behaviour as required

21 Requirements Analysis 9. 21 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Polymorphism  Redefinition of pay operation is example of polymorphism v Same pay message can be sent to many StaffMember objects v Each uses its own pay method depending upon class:

22 Requirements Analysis 9. 22 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved Summary v 4 important characteristics of OO: –message passing –encapsulation –inheritance –polymorphism

23 Requirements Analysis 9. 23 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved References v Bennett, S., McRobb, S. & Farmer, R. Object-Oriented Systems Analysis and Design using UML McGraw-Hill 2002 v Jacobson, I., Booch, G. and Rumbaugh, J. (1999), The Unified Software Development Process, Addison-Wesley, Reading Mass. v Rational Unified Process 2000


Download ppt "Requirements Analysis 9. 1 OO Concepts - 2005b509.ppt © Copyright De Montfort University 2000 All Rights Reserved INFO2005 Requirements Analysis Object."

Similar presentations


Ads by Google