www.it-ebooks.info
www.it-ebooks.info
BEGINNING SOFTWARE ENGINEERING
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
▸ PART I
SOFTWARE ENGINEERING STEP‐BY‐STEP
CHAPTER 1
Software Engineering from 20,000 Feet. . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2
Before the Beginning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
CHAPTER 3
Project Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
CHAPTER 4
Requirement Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
CHAPTER 5
High‐Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
CHAPTER 6
Low‐Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
CHAPTER 7
Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
CHAPTER 8
Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
CHAPTER 9
Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
CHAPTER 10
Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
CHAPTER 11
Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
▸ PART II
PROCESS MODELS
CHAPTER 12
Predictive Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
CHAPTER 13
Iterative Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
CHAPTER 14
RAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
APPENDIX
Solutions to Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
GLOSSARY
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
www.it-ebooks.info
www.it-ebooks.info
BEGINNING
I
Software Engineering
Rod Stephens
www.it-ebooks.info
Beginning Software Engineering
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2015 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-96914-4
ISBN: 978-1-118-96916-8 (ebk)
ISBN: 978-1-118-96917-5 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
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 as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)
748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or
promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work
is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional
services. If professional assistance is required, the services of a competent professional person should be sought. Neither
the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is
referred to in this work as a citation and/or a potential source of further information does not mean that the author or the
publisher endorses the information the organization or Web site may provide or recommendations it may make. Further,
readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this
work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with
standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to
media such as a CD or DVD that is not included in the version you purchased, you may download this material at
http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2015930533
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other
countries, and may not be used without written permission. All other trademarks are the property of their respective
owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
www.it-ebooks.info
ABOUT THE AUTHOR
ROD STEPHENS started out as a mathematician, but while studying at MIT, he discovered how
much fun programming is and he’s been programming professionally ever since. During his career,
he has worked on an eclectic assortment of applications in such fields as telephone switching, billing,
repair dispatching, tax processing, wastewater treatment, concert ticket sales, cartography, and
training for professional football players.
Rod has been a Microsoft Visual Basic Most Valuable Professional (MVP) for more than a decade
and has taught introductory programming courses. He has written more than two dozen books
that have been translated into languages from all over the world, and he’s written more than
250 magazine articles covering Visual Basic, C#, Visual Basic for Applications, Delphi, and Java.
Rod’s popular VB Helper website (www.vb-helper.com) receives several million hits per month and
contains thousands of pages of tips, tricks, and example programs for Visual Basic programmers.
His C# Helper website (www.csharphelper.com) contains similar material for C# programmers.
You can contact Rod at
[email protected] or
[email protected].
ABOUT THE TECHNICAL EDITOR
BRIAN HOCHGURTEL has been doing .NET development for over ten years, and actually started
his .NET experience with Rod Stephens when they wrote the Wiley book, Visual Basic.NET and
XML, in 2002. Currently Brian works with C#, SQL Server, and SharePoint in Fort Collins, CO.
www.it-ebooks.info
www.it-ebooks.info
CREDITS
EXECUTIVE EDITOR
PROFESSIONAL TECHNOLOGY & STRATEGY
DIRECTOR
Robert Elliott
Barry Pruett
PROJECT EDITOR
Adaobi Obi Tuiton
BUSINESS MANAGER
Amy Knies
TECHNICAL EDITOR
Brian Hochgurtel
ASSOCIATE PUBLISHER
Jim Minatel
PRODUCTION MANAGER
Kathleen Wisor
PROJECT COORDINATOR, COVER
Brent Savage
COPY EDITOR
San Dee Phillips
PROOFREADER
Sarah Kaikini, Word One
MANAGER OF CONTENT DEVELOPMENT &
ASSEMBLY
INDEXER
Mary Beth Wakefield
Johnna VanHoose Dinse
MARKETING DIRECTOR
COVER DESIGNER
David Mayhew
Wiley
MARKETING MANAGER
COVER IMAGE
Carrie Sherrill
©iStock.com/Chris Hepburn
p
www.it-ebooks.info
www.it-ebooks.info
ACKNOWLEDGMENTS
THANKS TO BOB ELLIOTT, Adaobi Obi Tulton, San Dee Phillips, Katie Wisor, and all the others who
worked so hard to make this book possible. (Adaobi was this book’s project manager. You’ll learn
what a project manager does in Chapter 3. It’s a bit different for writing a book but not as different
as you might think. As always, many thanks for your hard work, Adaobi!)
Thanks also to technical editor Brian Hochgurtel for giving me the benefit of his valuable
experience.
Special thanks to Mary Brodie at gearmark.blogs.com for letting me use her quote in Chapter 13,
“Iterative Models.”
www.it-ebooks.info
www.it-ebooks.info
CONTENTS
INTRODUCTION
xxi
PART I: SOFTWARE ENGINEERING STEP‐BY‐STEP
CHAPTER 1: SOFTWARE ENGINEERING FROM 20,000 FEET
Requirements Gathering
High‐Level Design
Low‐Level Design
Development
Testing
Deployment
Maintenance
Wrap‐up
Everything All at Once
Summary
3
4
5
6
6
6
8
9
9
10
11
CHAPTER 2: BEFORE THE BEGINNING
Document Management
Historical Documents
E‐mail
Code
Code Documentation
Application Documentation
Summary
15
16
18
19
21
22
25
25
CHAPTER 3: PROJECT MANAGEMENT
Executive Support
Project Management
29
30
31
PERT Charts
Critical Path Methods
Gantt Charts
Scheduling Software
Predicting Times
Get Experience
Break Unknown Tasks into Simpler Pieces
www.it-ebooks.info
33
38
41
42
42
44
44
CONTENTS
Look for Similarities
Expect the Unexpected
Track Progress
Risk Management
Summary
45
45
46
47
49
CHAPTER 4: REQUIREMENT GATHERING
Requirements Defined
53
54
Clear
Unambiguous
Consistent
Prioritized
Verifiable
Words to Avoid
54
55
56
56
60
60
Requirement Categories
61
Audience‐Oriented Requirements
Business Requirements
User Requirements
Functional Requirements
Nonfunctional Requirements
Implementation Requirements
FURPS
FURPS+
Common Requirements
Gathering Requirements
61
61
62
63
63
63
64
64
66
67
Listen to Customers (and Users)
Use the Five Ws (and One H)
Who
What
When
Where
Why
How
Study Users
67
68
68
68
69
69
69
69
70
Refining Requirements
71
Copy Existing Systems
Clairvoyance
Brainstorm
71
73
74
Recording Requirements
76
UML
User Stories
77
77
xii
www.it-ebooks.info
CONTENTS
Use Cases
Prototypes
Requirements Specification
78
78
80
Validation and Verification
Changing Requirements
Summary
80
80
81
CHAPTER 5: HIGH‐LEVEL DESIGN
The Big Picture
What to Specify
87
88
89
Security
Hardware
User Interface
Internal Interfaces
External Interfaces
Architecture
Monolithic
Client/Server
Component‐Based
Service‐Oriented
Data‐Centric
Event‐Driven
Rule‐Based
Distributed
Mix and Match
Reports
Other Outputs
Database
Audit Trails
User Access
Database Maintenance
Configuration Data
Data Flows and States
Training
89
90
91
92
93
94
94
95
96
97
97
97
98
98
99
101
102
102
103
103
104
104
105
105
UML
105
Structure Diagrams
Behavior Diagrams
Activity Diagrams
Use Case Diagram
State Machine Diagram
Interaction Diagrams
107
109
110
111
112
113
xiii
www.it-ebooks.info
CONTENTS
Sequence Diagram
Communication Diagram
Timing Diagram
Interaction Overview Diagram
Summary
113
114
115
115
116
CHAPTER 6: LOW‐LEVEL DESIGN
OO Design
119
120
Identifying Classes
Building Inheritance Hierarchies
Refinement
Generalization
Hierarchy Warning Signs
Object Composition
Database Design
121
122
123
125
126
127
127
Relational Databases
First Normal Form
Second Normal Form
Third Normal Form
Higher Levels of Normalization
Summary
128
130
134
135
137
138
CHAPTER 7: DEVELOPMENT
Use the Right Tools
143
144
Hardware
Network
Development Environment
Source Code Control
Profilers
Static Analysis Tools
Testing Tools
Source Code Formatters
Refactoring Tools
Training
Selecting Algorithms
144
145
146
147
147
147
147
147
148
148
148
Effective
Efficient
Predictable
Simple
Prepackaged
149
149
151
152
152
Top‐Down Design
153
xiv
www.it-ebooks.info
CONTENTS
Programming Tips and Tricks
Be Alert
Write for People, Not the Computer
Comment First
Write Self‐Documenting Code
Keep It Small
Stay Focused
Avoid Side Effects
Validate Results
Practice Offensive Programming
Use Exceptions
Write Exception Handers First
Don’t Repeat Code
Defer Optimization
Summary
155
155
156
157
159
160
161
162
163
165
166
167
167
167
169
CHAPTER 8: TESTING
173
Testing Goals
Reasons Bugs Never Die
175
175
Diminishing Returns
Deadlines
Consequences
It’s Too Soon
Usefulness
Obsolescence
It’s Not a Bug
It Never Ends
It’s Better Than Nothing
Fixing Bugs Is Dangerous
Which Bugs to Fix
175
175
176
176
176
177
177
177
178
178
179
Levels of Testing
179
Unit Testing
Integration Testing
Automated Testing
Component Interface Testing
System Testing
Acceptance Testing
Other Testing Categories
179
181
182
183
184
185
185
Testing Techniques
186
Exhaustive Testing
Black‐Box Testing
186
187
xv
www.it-ebooks.info
CONTENTS
White‐Box Testing
Gray‐Box Testing
188
188
Testing Habits
189
Test and Debug When Alert
Test Your Own Code
Have Someone Else Test Your Code
Fix Your Own Bugs
Think Before You Change
Don’t Believe in Magic
See What Changed
Fix Bugs, Not Symptoms
Test Your Tests
How to Fix a Bug
Estimating Number of Bugs
Tracking Bugs Found
Seeding
The Lincoln Index
189
189
190
192
193
193
193
194
194
194
195
195
197
197
Summary
198
CHAPTER 9: DEPLOYMENT
Scope
The Plan
Cutover
203
204
204
206
Staged Deployment
Gradual Cutover
Incremental Deployment
Parallel Testing
206
206
208
209
Deployment Tasks
Deployment Mistakes
Summary
209
210
211
CHAPTER 10: METRICS
215
Wrap Party
Defect Analysis
216
216
Kinds of Bugs
Discoverer
Severity
Time Created
Age at Fix
Task Type
Ishikawa Diagrams
217
217
217
218
218
218
219
xvi
www.it-ebooks.info
CONTENTS
Software Metrics
222
Qualities of Good Attributes and Metrics
Using Metrics
Process Metrics
Project Metrics
Things to Measure
Size Normalization
Function Point Normalization
Count Function Point Metrics
Multiply by Complexity Factors
Calculate Complexity Adjustment Value
Calculate Adjusted FP
Summary
223
224
226
226
227
229
231
232
232
233
235
235
CHAPTER 11: MAINTENANCE
Maintenance Costs
Task Categories
241
242
243
Perfective Tasks
Feature Improvements
New Features
The Second System Effect
Adaptive Tasks
Corrective Tasks
Preventive Tasks
Clarification
Code Reuse
Improved Flexibility
Bug Swarms
Bad Programming Practices
Individual Bugs
Not Invented Here
Task Execution
Summary
244
245
245
245
247
248
251
252
253
254
254
255
256
256
256
257
PART II: PROCESS MODELS
CHAPTER 12: PREDICTIVE MODELS
Model Approaches
Prerequisites
Predictive and Adaptive
265
266
267
267
Success and Failure Indicators
268
xvii
www.it-ebooks.info
CONTENTS
Advantages and Disadvantages
268
Waterfall
Waterfall with Feedback
Sashimi
Incremental Waterfall
V‐Model
Systems Development Life Cycle
Summary
270
271
272
273
275
276
280
CHAPTER 13: ITERATIVE MODELS
283
Iterative Versus Predictive
Iterative Versus Incremental
Prototypes
Types of Prototypes
Pros and Cons
284
286
287
288
289
Spiral
290
Clarifications
Pros and Cons
293
294
Unified Process
295
Pros and Cons
Rational Unified Process
296
297
Cleanroom
Summary
298
299
CHAPTER 14: RAD
303
RAD Principles
James Martin RAD
Agile
305
308
309
Self‐Organizing Teams
Agile Techniques
Communication
Incremental Development
Focus on Quality
XP
311
313
313
314
316
317
XP Roles
XP Values
XP Practices
Have a Customer On Site
Play the Planning Game
Use Standup Meetings
Make Frequent Small Releases
xviii
www.it-ebooks.info
318
319
319
320
320
321
322