Tải bản đầy đủ
Object-oriented Analysis and Design : Understanding System Development With UML 2.0

Object-oriented Analysis and Design : Understanding System Development With UML 2.0

Tải bản đầy đủ

Object-Oriented
Analysis and Design
Understanding System Development
with UML 2.0

Mike O’Docherty

Object-Oriented
Analysis and Design

Object-Oriented
Analysis and Design
Understanding System Development
with UML 2.0

Mike O’Docherty

Copyright  2005

John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester,
West Sussex PO19 8SQ, England
Telephone (+44) 1243 779777

Email (for orders and customer service enquiries): cs-books@wiley.co.uk
Visit our Home Page on www.wiley.com
All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system or
transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or
otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a
licence issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP, UK,
without the permission in writing of the Publisher. Requests to the Publisher should be addressed to the
Permissions Department, John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex
PO19 8SQ, England, or emailed to permreq@wiley.co.uk, or faxed to (+44) 1243 770620.
This publication is designed to provide accurate and authoritative information in regard to the subject
matter covered. It is sold on the understanding that the Publisher is not engaged in rendering professional
services. If professional advice or other expert assistance is required, the services of a competent
professional should be sought.
Other Wiley Editorial Offices
John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA
Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA
Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany
John Wiley & Sons Australia Ltd, 33 Park Road, Milton, Queensland 4064, Australia
John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809
John Wiley & Sons Canada Ltd, 22 Worcester Road, Etobicoke, Ontario, Canada M9W 1L1
Wiley also publishes its books in a variety of electronic formats. Some content that appears
in print may not be available in electronic books.
Library of Congress Cataloging-in-Publication Data
O’Docherty, Mike.
Object-oriented analysis and design : understanding system development
with UML 2.0 / Mike O’Docherty.
p. cm.
Includes bibliographical references and index.
ISBN-13 978-0-470-09240-8
ISBN-10 0-470-09240-8 (pbk. : alk. paper)
1. Object-oriented programming (Computer science) 2. Computer
software–Development. I. Title.
QA76.64.O35 2005
005.1 17 – dc22
2005004182
British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
ISBN-13 978-0-470-09240-8
ISBN-10 0-470-09240-8
Typeset in 10/14 Berkeley-Medium by Laserwords Private Limited, Chennai, India
Printed and bound in Great Britain by Biddles Ltd, King’s Lynn
This book is printed on acid-free paper responsibly manufactured from sustainable forestry
in which at least two trees are planted for each one used for paper production.

For Alice and George

Contents

1 Introduction
1.1 Background
1.2 A Brief History of Programming
1.3 Methodologies
1.4 About this Book
1.4.1 Content Overview
1.4.2 Case Studies
1.4.3 Navigation

2
4
4
5
5
6
7
7

Part I Setting the Scene

9

2 Object Concepts
2.1 Introduction
2.2 What Is an Object?
2.3 Identical or Equal?
2.4 Depicting Objects
2.5 Encapsulation
2.6 Association and Aggregation
2.7 Graphs and Trees
2.8 Links and Navigability
2.9 Messages
2.10 Invoking an Operation
2.11 An Example Collaboration
2.12 How an Object-Oriented Program Works
2.13 Garbage Collection
2.14 Classes
2.15 What Does a Class Define?
2.16 Shared Data and Shared Operations
2.17 Types
2.18 Terminology
2.19 Reusing Code

10
12
13
16
19
20
21
23
25
27
28
30
32
32
34
37
39
40
41
43

viii

Contents

2.20 Summary
Further Reading
Review Questions
Answers to Activity 1
Answers to Review Questions

48
48
48
50
50

3 Inheritance
3.1 Introduction
3.2 Designing a Class Hierarchy
3.3 Adding Implementations to a Class Hierarchy
3.4 Abstract Classes
3.5 Redefining Methods
3.6 Implementing a Stack Class
3.6.1 Implementing a Stack using Inheritance
3.6.2 Implementing a Stack using Composition
3.6.3 Inheritance versus Composition
3.7 Multiple Inheritance
3.8 Guidelines for Using Inheritance
3.9 Summary
Further Reading
Review Questions
Answers to Review Questions

52
54
55
58
59
63
64
65
66
68
69
73
73
74
74
75

4 Type Systems
4.1 Introduction
4.2 Dynamic and Static Type Systems
4.3 Polymorphism
4.3.1 Polymorphic Variables
4.3.2 Polymorphic Messages
4.4 Dynamic Binding
4.5 Polymorphism Guideline
4.6 Type Casting
4.7 Explicit Casts
4.8 Genericity with Templates
4.9 Summary
Further Reading
Review Questions
Answers to Activity 2
Answers to Activity 3
Answers to Review Questions

78
80
80
82
82
83
85
87
88
89
91
93
93
93
95
95
96

Contents

5 Software Development Methodologies
5.1 Introduction
5.2 Classical Phases in Software Production
5.2.1 Requirements
5.2.2 Analysis
5.2.3 Design
5.2.4 Specification
5.2.5 Implementation
5.2.6 Testing
5.2.7 Deployment
5.2.8 Maintenance
5.2.9 Key Questions
5.3 Software Engineering and the Waterfall Methodology
5.4 New Methodologies
5.4.1 Spiral Methodology
5.4.2 Iterative Methodology
5.4.3 Incremental Methodology
5.4.4 Combining the Methodologies
5.5 Object-Oriented Methodologies
5.5.1 UML, RUP and XP
5.5.2 The Need for Development Tools
5.6 Ripple Overview
5.6.1 Use Case Diagram
5.6.2 Class Diagram (Analysis Level)
5.6.3 Communication Diagram
5.6.4 Deployment Diagram
5.6.5 Class Diagram (Design Level)
5.6.6 Sequence Diagram
5.7 Summary
Further Reading
Review Questions
Answers to Review Questions

Part II Understanding the Problem
6 Gathering Requirements
6.1 Introduction
6.2 The Birth of a System

98
100
102
102
102
103
103
104
104
104
104
105
106
110
110
111
112
113
114
115
116
117
120
121
122
123
124
125
126
126
127
128

129
130
132
133

ix