book-SE_marsic.pdf - Last updated Ivan Marsic Copyright...

This preview shows page 1 out of 627 pages.

Unformatted text preview: Last updated: September 10, 2012 Ivan Marsic Copyright © 2012 by Ivan Marsic. All rights reserved. Rutgers University, New Brunswick, New Jersey Permission to reproduce or copy all or parts of this material for non-profit use is granted on the condition that the author and source are credited. Suggestions and comments are welcomed. Author’s address: Rutgers University Department of Electrical and Computer Engineering 94 Brett Road Piscataway, New Jersey 08854 [email protected] Book website: Preface This book reviews important technologies for software development with a particular focus on Web applications. In reviewing these technologies I put emphasis on underlying principles and basic concepts, rather than meticulousness and completeness. In design and documentation, if conflict arises, clarity should be preferred to precision because, as will be described, the key problem of software development is having a functioning communication between the involved human parties. My main goal in writing this book has been to make it useful. The developer should always keep in mind that software is written for people, not for computers. Computers just run software—a minor point. It is people who understand, maintain, improve, and use software to solve problems. Solving a problem by an effective abstraction and representation is a recurring theme of software engineering. The particular technologies evolve or become obsolete, but the underlying principles and concepts will likely resurface in new technologies. Audience This book is designed for upper-division undergraduate and graduate courses in software engineering. It intended primarily for learning, rather than reference. I also believe that the book’s focus on core concepts should be appealing to practitioners who are interested in the “whys” behind the software engineering tools and techniques that are commonly encountered. I assume that readers will have some familiarity with programming languages and I do not cover any programming language in particular. Basic knowledge of discrete mathematics and statistics is desirable for some advanced topics, particularly in Chapters 3 and 4. Most concepts do not require mathematical sophistication beyond a first undergraduate course. Approach and Organization The first part (Chapters 1–5) is intended to accompany a semester-long hands-on team project in software engineering. In the spirit of agile methods, the project consists of two iterations. The first iteration focuses on developing some key functions of the proposed software product. It is also exploratory to help with sizing the effort and setting realistic goals for the second iteration. In the second iteration the students perform the necessary adjustments, based on what they have learned in the first iteration. Appendix G provides a worked example of a full software engineering project. The second part (Chapters 6–8 and most Appendices) is intended for a semester-long course on software engineering of Web applications. It also assumes a hands-on student team project. The focus is on Web applications and communication between clients and servers. Appendix F briefly surveys user interface design issues because I feel that proper treatment of this topic requires a book on its own. I tried to make every chapter self-contained, so that entire chapters can be i Ivan Marsic Rutgers University ii skipped if necessary. But you will not benefit the most by reading it that way. I tried to avoid “botanical” approach, telling you in detail what is here and what is there in software engineering, so you can start from any point and walk it over in any way. Instead, this book takes an evolutionary approach, where new topics systematically build on previous topics. The text follows this outline. Chapter 2 introduces object-oriented software engineering. It is short enough to be covered in few weeks, yet it provides sufficient knowledge for students to start working on a first version of their software product. Appendix G complements the material of Chapter 2 by showing a practical application of the presented concepts. In general, this knowledge may be sufficient for amateur software development, on relatively small and non-mission-critical projects. Chapters 3 through 5 offer more detailed coverage of the topics introduced in Chapter 2. They are intended to provide the foundation for iterative development of high-quality software products. Chapters 6 – 8 provide advanced topics which can be covered selectively, if time permits, or in a follow-up course dedicated to software engineering of Web applications. This is not a programming text, but several appendices are provided as reference material for special topics that will inevitably arise in many software projects. Examples, Code, and Solved Problems I tried to make this book as practical as possible by using realistic examples and working through their solutions. I usually find it difficult to bridge the gap between an abstract design and coding. Hence, I include a great deal of code. The code is in the Java programming language, which brings me to another point. Different authors favor different languages and students often complain about having to learn yet another language on not having learned enough languages. I feel that the issue of selecting a programming language for a software engineering textbook is artificial. Programming language is a tool and the software engineer should master a “toolbox” of languages so to be able to choose the tool that best suits the task at hand. Every chapter (except for Chapters 1 and 9) is accompanied with a set of problems. Solutions to most problems can be found on the back of this book, starting on page 523. Design problems are open-ended, without a unique or “correct” solution, so the reader is welcome to question all the designs offered in this book. I have myself gone through many versions of each design, and will probably change them again in the future, as I learn more and think more. At the least, the designs in this book represent a starting point to critique and improve. Additional information about team projects and online links to related topics can be found at the book website: . Contents at a Glance PREFACE ................................................................................................................................ I CONTENTS AT A GLANCE ..................................................................................................................... III TABLE OF CONTENTS ........................................................................................................................... V CHAPTER 1 INTRODUCTION .......................................................................................................... 1 CHAPTER 2 OBJECT-ORIENTED SOFTWARE ENGINEERING .............................................................. 61 CHAPTER 3 MODELING AND SYSTEM SPECIFICATION ................................................................... 170 CHAPTER 4 SOFTWARE MEASUREMENT AND ESTIMATION ............................................................. 217 CHAPTER 5 DESIGN WITH PATTERNS ......................................................................................... 246 CHAPTER 6 XML AND DATA REPRESENTATION ........................................................................... 319 CHAPTER 7 SOFTWARE COMPONENTS ....................................................................................... 361 CHAPTER 8 WEB SERVICES ..................................................................................................... 374 CHAPTER 9 FUTURE TRENDS.................................................................................................... 410 APPENDIX A JAVA PROGRAMMING ............................................................................................. 417 APPENDIX B NETWORK PROGRAMMING ...................................................................................... 419 APPENDIX C HTTP OVERVIEW ................................................................................................... 433 APPENDIX D DATABASE-DRIVEN WEB APPLICATIONS ................................................................... 442 APPENDIX E DOCUMENT OBJECT MODEL (DOM) ......................................................................... 443 APPENDIX F USER INTERFACE PROGRAMMING ............................................................................. 446 APPENDIX G EXAMPLE PROJECT: TIC-TAC-TOE GAME .................................................................. 449 APPENDIX H SOLUTIONS TO SELECTED PROBLEMS ....................................................................... 523 iii Ivan Marsic REFERENCES Rutgers University iv ........................................................................................................................... 596 ACRONYMS AND ABBREVIATIONS ....................................................................................................... 606 INDEX ........................................................................................................................... 608 Software Engineering Contents v Table of Contents PREFACE ................................................................................................................................ I CONTENTS AT A GLANCE ..................................................................................................................... III TABLE OF CONTENTS ........................................................................................................................... V CHAPTER 1 INTRODUCTION .......................................................................................................... 1 1.1 What is Software Engineering? ...................................................................................... 2 1.1.1 Why Software Engineering Is Difficult (1) ................................................................................. 7 1.1.2 Book Organization ................................................................................................................ 8 1.2 Software Engineering Lifecycle ...................................................................................... 8 1.2.1 Symbol Language ............................................................................................................... 11 1.2.2 Requirements Analysis and System Specification .................................................................. 13 1.2.3 Object-Oriented Analysis and the Domain Model.................................................................... 15 1.2.4 Object-Oriented Design ....................................................................................................... 17 1.2.5 Project Effort Estimation and Product Quality Measurement .................................................... 20 1.3 Case Studies .............................................................................................................. 25 1.3.1 Case Study 1: From Home Access Control to Adaptive Homes................................................ 26 1.3.2 Case Study 2: Personal Investment Assistant ........................................................................ 30 1.4 The Object Model ....................................................................................................... 39 1.4.1 Controlling Access to Object Elements .................................................................................. 44 1.4.2 Object Responsibilities and Relationships.............................................................................. 47 1.4.3 Reuse and Extension by Inheritance and Composition ............................................................ 48 1.5 Student Team Projects ................................................................................................ 49 1.5.1 Stock Market Investment Fantasy League ............................................................................. 49 1.5.2 Web-based Stock Forecasters ............................................................................................. 52 1.5.3 Remarks about the Projects ................................................................................................. 54 1.6 Summary and Bibliographical Notes ............................................................................. 57 CHAPTER 2 OBJECT-ORIENTED SOFTWARE ENGINEERING .............................................................. 61 2.1 Software Development Methods ................................................................................... 62 2.1.1 Agile Development .............................................................................................................. 63 Ivan Marsic 2.1.2 2.2 Rutgers University vi Decisive Methodological Factors .......................................................................................... 65 Requirements Engineering .......................................................................................... 68 2.2.1 Requirements and User Stories ............................................................................................ 70 2.2.2 Requirements Gathering Strategies ...................................................................................... 77 2.2.3 Effort Estimation ................................................................................................................. 78 2.3 Software Architecture .................................................................................................. 80 2.3.1 Problem Architecture ........................................................................................................... 82 2.3.2 Software Architectural Styles ................................................................................................ 86 2.3.3 Recombination of Subsystems ............................................................................................. 87 2.4 Use Case Modeling ..................................................................................................... 88 2.4.1 Actors, Goals, and Sketchy Use Cases ................................................................................. 88 2.4.2 System Boundary and Subsystems....................................................................................... 94 2.4.3 Detailed Use Case Specification ........................................................................................... 96 2.4.4 Security and Risk Management ...........................................................................................107 2.4.5 Why Software Engineering Is Difficult (2) ..............................................................................108 2.5 Analysis: Building the Domain Model .......................................................................... 109 2.5.1 Identifying Concepts ...........................................................................................................110 2.5.2 Concept Associations and Attributes ....................................................................................113 2.5.3 Domain Analysis ................................................................................................................118 2.5.4 Contracts: Preconditions and Postconditions ........................................................................119 2.6 Design: Assigning Responsibilities ............................................................................. 120 2.6.1 Design Principles for Assigning Responsibilities ....................................................................124 2.6.2 Class Diagram ...................................................................................................................130 2.6.3 Why Software Engineering Is Difficult (3) ..............................................................................133 2.7 Test-driven Implementation........................................................................................ 133 2.7.1 Overview of Software Testing ..............................................................................................134 2.7.2 Test Coverage and Code Coverage .....................................................................................136 2.7.3 Practical Aspects of Unit Testing .........................................................................................140 2.7.4 Integration and Security Testing ..........................................................................................143 2.7.5 Test-driven Implementation .................................................................................................146 2.7.6 Refactoring: Improving the Design of Existing Code ..............................................................151 2.8 Summary and Bibliographical Notes ........................................................................... 152 Problems ............................................................................................................................ 156 CHAPTER 3 MODELING AND SYSTEM SPECIFICATION ................................................................... 170 3.1 What is a System? .................................................................................................... 171 3.1.1 World Phenomena and Their Abstractions ............................................................................172 3.1.2 States and State Variables ..................................................................................................176 3.1.3 Events, Signals, and Messages ...........................................................................................181 Software Engineering Contents vii 3.1.4 Context Diagrams and Domains ..........................................................................................183 3.1.5 Systems and System Descriptions .......................................................................................185 3.2 Notations for System Specification ............................................................................. 186 3.2.1 Basic Formalisms for Specifications .....................................................................................186 3.2.2 UML State Machine Diagrams .............................................................................................193 3.2.3 UML Object Constraint Language (OCL) ..............................................................................196 3.2.4 TLA+ Notation ...................................................................................................................201 3.3 Problem Frames ....................................................................................................... 203 3.3.1 Problem Frame Notation .....................................................................................................204 3.3.2 Problem Decomposition into Frames....................................................................................205 3.3.3 Composition of Problem Frames..........................................................................................208 3.3.4 Models ..............................................................................................................................209 3.4 Specifying Goals ....................................................................................................... 210 3.5 Summary and Bibliographical Notes ........................................................................... 211 Problems ............................................................................................................................ 212 CHAPTER 4 SOFTWARE MEASUREMENT AND ESTIMATION ............................................................. 217 4.1 Fundamentals of Measurement Theory ...............................................................
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture