Presentation is loading. Please wait.

Presentation is loading. Please wait.

©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.

Similar presentations


Presentation on theme: "©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design."— Presentation transcript:

1 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design

2 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 2 Objectives l To explain how a software design may be represented as a set of interacting objects that manage their own state and operations l To describe the activities in the object- oriented design process l To introduce various models that can be used to describe an object-oriented design l To show how the UML may be used to represent these models

3 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 3 Topics covered l Objects and object classes l An object-oriented design process l Design evolution

4 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 4 Object-oriented development l Object-oriented analysis, design and programming are related but distinct. l OOA is concerned with developing an object model of the application domain. l OOD is concerned with developing an object- oriented system model to implement requirements. l OOP is concerned with realising an OOD using an OO programming language such as Java or C++.

5 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 5 Characteristics of OOD l Objects are abstractions of real-world or system entities and manage themselves. l Objects are independent and encapsulate state and representation information. l System functionality is expressed in terms of object services. l Shared data areas are eliminated. Objects communicate by message passing. l Objects may be distributed and may execute sequentially or in parallel.

6 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 6 Interacting objects

7 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 7 Advantages of OOD l Easier maintenance. Objects may be understood as stand-alone entities. l Objects are potentially reusable components. l For some systems, there may be an obvious mapping from real world entities to system objects.

8 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 8 Objects and object classes An object is an entity that has a state and a defined set of operations which operate on that state. The state is represented as a set of object attributes. The operations associated with the object provide services to other objects (clients) which request these services when some computation is required. Objects are created according to some object class definition. An object class definition serves as a template for objects. It includes declarations of all the attributes and services which should be associated with an object of that class.

9 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 9 The Unified Modeling Language l Several different notations for describing object- oriented designs were proposed in the 1980s and 1990s. l The Unified Modeling Language is an integration of these notations. l It describes notations for a number of different models that may be produced during OO analysis and design. l It is now a de facto standard for OO modelling.

10 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 10 Employee object class (UML)

11 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 11 UML associations l Objects and object classes participate in relationships with other objects and object classes. l In the UML, a generalised relationship is indicated by an association. l Associations may be annotated with information that describes the association. l Associations are general but may indicate that an attribute of an object is an associated object or that a method relies on an associated object.

12 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 12 An association model

13 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 13 An object-oriented design process l Structured design processes involve developing a number of different system models. l They require a lot of effort for development and maintenance of these models and, for small systems, this may not be cost- effective. l However, for large systems developed by different groups design models are an essential communication mechanism.

14 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 14 Object identification l Identifying objects (or object classes) is the most difficult part of object oriented design. l There is no 'magic formula' for object identification. It relies on the skill, experience and domain knowledge of system designers. l Object identification is an iterative process. You are unlikely to get it right first time.

15 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 15 A use case is a summary of scenarios for a single task or goal. An actor is who or what initiates the events involved in that task. Actors are simply roles that people or objects play. The picture below is a Make Appointment use case for the medical clinic. The actor is a Patient. The connection between actor and use case is a communication association (or communication for short). determining features (requirements). New use cases often generate new requirements as the system is analyzed and the design takes shape. communicating with clients. Their notational simplicity makes use case diagrams a good way for developers to communicate with clients. generating test cases. The collection of scenarios for a use case may suggest a suite of test cases for those scenarios

16 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 16 A Class diagram gives an overview of a system by showing its classes and the relationships among them. Class diagrams are static -- they display what interacts but not what happens when they do interact.

17 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 17 association -- a relationship between instances of the two classes. There is an association between two classes if an instance of one class must know about the other in order to perform its work. In a diagram, an association is a link connecting two classes. aggregation -- an association in which one class belongs to a collection. An aggregation has a diamond end pointing to the part containing the whole. In our diagram, Order has a collection of OrderDetails. generalization -- an inheritance link indicating one class is a superclass of the other. A generalization has a triangle pointing to the superclass. Payment is a superclass of Cash, Check, and Credit.

18 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 18 Packages and object diagrams To simplify complex class diagrams, you can group classes into packages. A package is a collection of logically related UML elements. The diagram below is a business model in which the classes are grouped into packages.

19 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 19 A sequence diagram is an interaction diagram that details how operations are carried out -- what messages are sent and when. Sequence diagrams are organized according to time. The time progresses as you go down the page. The objects involved in the operation are listed from left to right according to when they take part in the message sequence.

20 ©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 20 Collaboration diagrams are also interaction diagrams. They convey the same information as sequence diagrams, but they focus on object roles instead of the times that messages are sent. In a sequence diagram, object roles are the vertices and messages are the connecting links.


Download ppt "©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design."

Similar presentations


Ads by Google