BOOKS FOR PROFESSIONALS BY PROFESSIONALS® Dooley Software Development and RELATED Professional Practice Make your code work harder! Software Development and Professional Practice will show you how you can improve your coding practices and write better programs. It teaches you: • Characteristics of good programs • Coding standards and how to apply them to real coding • Debugging, unit testing, and modularity • Object-oriented programming (OOP) design principles and great coding Software Development and Professional Practice will help you to understand the prin- ciples of good software design and, in turn, how to write great code. You’ll learn: • What methods and processes are available to help you design great software • How to apply software engineering principles to your daily coding practice • How to apply the principles you’ve learned to specific and real-world coding problems • How to construct professional standard code Software Development and Professional Practice covers many of the topics described for the ACM Computing Curricula 2001 course C292c Software Development and Professional Practice. Making it both an ideal textbook and authoritative manual for the working professional. US $49.99 Shelve in Software Engineering/ Software Development User level: Beginning–Advanced SOURCE CODE ONLINE www.apress.com www.it-ebooks.info For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. www.it-ebooks.info Software Development and Professional Practice John Dooley www.it-ebooks.info Software Development and Professional Practice Copyright © 2011 by John Dooley All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-3801-0 ISBN-13 (electronic): 978-1-4302-3802-7 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. President and Publisher: Paul Manning Lead Editor: Dominic Shakeshaft Technical Reviewer: John Zukowski Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, James Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Adam Heath Copy Editor: Tracy Brown Compositor: Bytheway Publishing Services Indexer: Toma Mulligan Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer- sbm.com, or visit www.springeronline.com. For information on translations, please e-mail [email protected], or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. You will need to answer questions pertaining to this book in order to successfully download the code. www.it-ebooks.info For Diane, who is always there; for Patrick, the best son a guy could have; and for Margaret Teresa Hume Dooley (1926–1976), the first one is for you, Mom. www.it-ebooks.info Contents at a Glance About the Author..................................................................................................xiv About the Technical Reviewer..............................................................................xv Acknowledgments...............................................................................................xvi Preface................................................................................................................xvii Chapter 1: Introduction to Software Development.................................................1 Chapter 2: Process Life Cycle Models.....................................................................7 Chapter 3: Project Management Essentials..........................................................27 Chapter 4: Requirements......................................................................................37 Chapter 5: Software Architecture.........................................................................47 Chapter 6: Design Principles................................................................................59 Chapter 7: Structured Design...............................................................................71 Chapter 8: Object-Oriented Analysis and Design—An Overview.........................87 Chapter 9: Object-Oriented Analysis and Design.................................................99 Chapter 10: Object-Oriented Design Principles..................................................115 Chapter 11: Design Patterns...............................................................................137 Chapter 12: Code Construction...........................................................................159 Chapter 13: Debugging.......................................................................................181 Chapter 14: Unit Testing.....................................................................................193 Chapter 15: Walkthroughs, Code Reviews, and Inspections..............................209 Chapter 16: Wrapping It all Up............................................................................221 Index...................................................................................................................227 iv www.it-ebooks.info Contents About the Author..................................................................................................xiv About the Technical Reviewer..............................................................................xv Acknowledgments...............................................................................................xvi Preface................................................................................................................xvii Chapter 1: Introduction to Software Development.................................................1 What We’re Doing..............................................................................................................2 So, How to Develop Software?..........................................................................................2 Conclusion.........................................................................................................................4 References.........................................................................................................................5 Chapter 2: Process Life Cycle Models.....................................................................7 A Model That’s not a Model At All: Code and Fix...............................................................8 Cruising over the Waterfall................................................................................................9 Backing Up the Waterfall.................................................................................................11 Loops Are Your Friend.....................................................................................................12 Evolving the Incremental Model......................................................................................13 Agile Is as Agile Does......................................................................................................14 eXtreme Programming (XP).............................................................................................15 XP Overview.....................................................................................................................15 XP Motivation...................................................................................................................16 The Four Variables...........................................................................................................16 v www.it-ebooks.info CONTENTS The Four Values...............................................................................................................17 The 15 Principles.............................................................................................................17 The Four Basic Activities.................................................................................................19 Implementing XP: The 12 Practices.................................................................................20 The XP Life Cycle.............................................................................................................22 Scrum, mate....................................................................................................................23 Conclusion.......................................................................................................................25 References.......................................................................................................................25 Chapter 3: Project Management Essentials..........................................................27 Project Planning...............................................................................................................27 Project Organization........................................................................................................28 Risk Analysis....................................................................................................................28 Resource Requirements..................................................................................................30 Work Breakdown and Task Estimates.............................................................................31 Project Schedule..............................................................................................................31 Project Oversight.............................................................................................................34 Status Reviews and Presentations..................................................................................34 Defects.............................................................................................................................35 The Post-Mortem.............................................................................................................35 Conclusion.......................................................................................................................36 References.......................................................................................................................36 Chapter 4: Requirements......................................................................................37 What Types of Requirements Are We Talking About Here?.............................................37 Functional Specification?................................................................................................38 But I Don’t Like Writing!...................................................................................................38 vi www.it-ebooks.info CONTENTS That Natural Language Thing..........................................................................................38 Outline of a Functional Specification...............................................................................39 Overview..........................................................................................................................39 Disclaimer........................................................................................................................39 Author’s Name.................................................................................................................39 Scenarios of Typical Usage..............................................................................................40 Detailed Screen-By-Screen Specifications......................................................................40 Non-requirements............................................................................................................40 Open Issues.....................................................................................................................41 Design and Feature Ideas................................................................................................41 Backlog............................................................................................................................41 One More Thing...............................................................................................................42 Types of Requirements....................................................................................................42 User Requirements..........................................................................................................42 Domain Requirements.....................................................................................................42 Non-functional Requirements..........................................................................................43 Non-requirements............................................................................................................43 Requirements Digging.....................................................................................................43 Why Requirements Digging Is Hard.................................................................................44 Analyzing the Requirements............................................................................................45 Conclusion.......................................................................................................................46 References.......................................................................................................................46 Chapter 5: Software Architecture.........................................................................47 General Architectural Patterns.........................................................................................48 Pipe-and-filter Architecture.............................................................................................48 vii www.it-ebooks.info CONTENTS An Object-Oriented Architectural Pattern........................................................................49 An MVC Example: Let’s Hunt!..........................................................................................51 The Problem.....................................................................................................................51 Model...............................................................................................................................52 View.................................................................................................................................52 Controller.........................................................................................................................53 Model...............................................................................................................................53 The Client-Server Architectural Pattern...........................................................................53 The Layered Approach.....................................................................................................54 The Main Program: Subroutine Architectural Pattern......................................................56 Conclusion.......................................................................................................................57 References.......................................................................................................................58 Chapter 6: Design Principles................................................................................59 The Design Process.........................................................................................................62 Desirable Design Characteristics (Things Your Design Should Favor).............................63 Design Heuristics.............................................................................................................64 Designers and Creativity..................................................................................................66 Conclusion.......................................................................................................................67 References.......................................................................................................................68 Chapter 7: Structured Design...............................................................................71 Structured Programming.................................................................................................71 Stepwise Refinement.......................................................................................................72 Example of Stepwise Refinement: The Eight-Queens Problem..............................................................73 Modular Decomposition...................................................................................................79 Example: Keyword in Context: Indexes for You and Me.........................................................................80 viii www.it-ebooks.info
Description: