You are previewing .NET-A Complete Development Cycle.
O'Reilly logo
.NET-A Complete Development Cycle

Book Description

Praise for .NET—A Complete Development Cycle

“Excellent step-by-step walkthrough of software development with .NET for architects and programmers. Great explanation of current software development methodologies, and a wealth of practical examples using current techniques.”

         —Phil Syme
             Technical Lead
             Watson Wyatt Worldwide
             Washington, D.C.

“This book takes a unique approach to integrating real-world development examples to illustrate the phases and tasks of the software development lifecycle.”

         —Jackie Goldstein
             Renaissance Computer Systems Ltd.
             and MSDN Regional Director

“In this book the authors excel in presenting all aspects of the .NET development cycle in a format accessible to the beginner, and as a primer and reference for the experienced developer. It is exemplary in its encouragement of good software engineering technique from the outset by adhering to the Unified Process. This book is not only educational and informative, but working through it is fun!”

         —Dr. Oliver Downs
             Chief Scientist, Analytical Insights, Inc.
             http://www.analyticalinsights.com

“As a software project manager, I found this book and accompanying CD to be a valuable aid to help sort out the practical application of .NET from all the hype.”

         —Daniel Paulish
             Software engineering project manager with
             more than 20 years’ experience

.NET—A Complete Development Cycle is the first guide to combining the best software-engineering practices of the Unified Process with the ins and outs of the .NET architecture. The book begins with an overview of the principles of software engineering and then introduces Microsoft technologies such as Visual C#, Windows Forms (WinForms), ADO.NET, and ASP.NET.

Central to this practical guide is a case study developing a working imaging application. As the authors lead readers through the complete lifecycle of this .NET development project, they teach effective software-engineering methodologies, including top strategies for requirements engineering, functional breakdown, design reviews, implementation, testing, and deployment. Readers will also learn how to make the most of tools such as the Unified Modeling Language (UML), GDI+, multithreading, Web Services Description Language (WSDL), Simple Object Access Protocol (SOAP), Universal Description, Discovery and Integration (UDDI), and versioning.

By actively participating in this case study, readers become working members of the development team. They use their newly acquired knowledge to accomplish tasks critical to the successful creation of the Web-based smart-client application.

Whether you are making the transition to .NET architecture or are an experienced Microsoft developer, project lead, or software quality engineer who wants to learn effective software-engineering techniques, .NET—A Complete Development Cycle is an invaluable resource. Readers will come away with the foundation needed to use .NET technologies to design and build complete applications, a solid understanding of good software-engineering practices, and a working Web-based imaging application that can easily be expanded or customized.



Table of Contents

  1. Copyright
    1. Dedication
  2. Praise for .NET—A Complete Development Cycle
  3. Preface
    1. Who Should Read This Book?
    2. How Is This Book Structured?
    3. What Is Covered in This Book?
    4. How Should This Book Be Read?
    5. What Is Provided on the CD?
  4. Acknowledgments
    1. Personal Acknowledgments
      1. Gunther Lenz
      2. Thomas Moeller
  5. About the Authors
  6. 1. Introducing .NET
    1. 1.1. The Need for .NET
    2. 1.2. The .NET Framework
      1. 1.2.1. The Common Language Runtime
        1. Managed Execution
        2. Language Independence
        3. Platform Interoperability
        4. Garbage Collection
        5. Security
        6. Versioning, or the End of DLL Hell
        7. Simplified Deployment and Upgrading
        8. Consistent Method Failure Paradigm
      2. 1.2.2. The Framework Class Library (FCL)
        1. The System Namespace
        2. Diagnostics and Profiling
        3. Configuration Management
        4. String Manipulation
        5. Collections
        6. Input and Output
        7. Remote Calls
        8. Reflection
        9. Security
        10. Data Access with ADO.NET
        11. Smart Client Applications
        12. Web Applications with ASP.NET
        13. Web Services
    3. 1.3. The C# Language
    4. 1.4. Debugging and the IDE
    5. 1.5. References for Further Reading
        1. .NET Introduction
        2. Application Development
        3. Security
        4. OOP and C#
        5. ADO
        6. ASP and XML
  7. 2. Introducing Software Engineering
    1. 2.1. Introducing Software Engineering Practices
    2. 2.2. Choosing a Software Development Model
    3. 2.3. Commonly Used Software Development Models
      1. 2.3.1. The Code and Fix Software Development Model
        1. Characteristics
        2. Definition
        3. Pro
        4. Cons
      2. 2.3.2. The Waterfall Software Development Model
        1. Characteristics
        2. Definition
        3. Pros
        4. Cons
        5. Variations
      3. 2.3.3. The V Software Development Model
        1. Characteristics
        2. Definition
        3. Pros
        4. Cons
        5. Variations
      4. 2.3.4. The Spiral Software Development Model
        1. Characteristics
        2. Definition
        3. Pros
        4. Cons
        5. Variations
      5. 2.3.5. The Staged Delivery Software Development Model
        1. Characteristics
        2. Definition
        3. Pros
        4. Cons
        5. Variations
      6. 2.3.6. The Evolutionary Prototyping Software Development Model
        1. Characteristics
        2. Definition
        3. Pros
        4. Cons
        5. Variations
      7. 2.3.7. The Scrum Software Development Model
        1. Definition
        2. Pros
        3. Cons
        4. Variations
      8. 2.3.8. The Adaptive Software Development Model
        1. Definition
        2. Pros
        3. Cons
        4. Variations
      9. 2.3.9. The Unified Process Software Development Model
        1. Definition
        2. Pros
        3. Cons
        4. Variations
      10. 2.3.10. The Extreme Programming Software Development Model
        1. Definition
        2. Pros
        3. Cons
        4. Variations:
    4. 2.4. Conclusion
    5. 2.5. References for Further Reading
        1. General Project Management and Software Engineering Models
  8. 3. A .NET Prototype
    1. 3.1. Getting Started
    2. 3.2. Evaluating .NET for Windows Client Applications
    3. 3.3. Our First .NET Application
    4. 3.4. Prototyping
    5. 3.5. Implementing the SmartNotes Application
      1. 3.5.1. Creating a New Project
      2. 3.5.2. Modifying Form Properties
      3. 3.5.3. Adding Controls to a Form
      4. 3.5.4. Adding a Form to the Project
      5. 3.5.5. Creating an Event Handler
      6. 3.5.6. Implementing a Timer
    6. 3.6. Visual Studio.NET: Platform of Choice
    7. 3.7. References for Further Reading
  9. 4. Project Planning
    1. 4.1. The Project Vision and Business Case
    2. 4.2. The Initial Use Case Model
      1. 4.2.1. Requirement Keys
      2. 4.2.2. Using XML for Requirements Documents
    3. 4.3. Project Requirements
    4. 4.4. Initial Project Planning
      1. 4.4.1. Project Management Planning
        1. Software Configuration Management
        2. Requirements Tracing
        3. Effort Estimates and Resource Allocation
        4. Iteration Planning
        5. Project Tracking
        6. Test Strategy
        7. Defect Tracking
      2. 4.4.2. Project Implementation Planning
        1. Code Documentation
        2. Reviews
        3. Error and Exception Handling
        4. Project Coding Guidelines
    5. 4.5. Initial Risk Analysis
    6. 4.6. Initial Requirements Analysis and Design
      1. 4.6.1. The Photo Editor
      2. 4.6.2. The Image-Processing Library
      3. 4.6.3. The Online Shop
        1. Web Forms
        2. Code Behind
        3. State Management
      4. 4.6.4. Defining Architectural Requirements
    7. 4.7. Conclusion
    8. 4.8. References for Further Reading
        1. Unified Modeling Language (UML)
        2. Use Case Modeling
        3. Configuration Management Tools
        4. Code Review
        5. XML and XSL
        6. Exception Handling
        7. Coding Guidelines
        8. Risk Management
  10. 5. The Photo Editor Application
    1. 5.1. The Refined Project Vision and Business Case
    2. 5.2. Refined Requirements for Online Photo Shop
      1. 5.2.1. Refined Use Case Diagram
      2. 5.2.2. Refined Requirements List
    3. 5.3. Analysis of the Photo Editor Requirements
      1. 5.3.1. The photo_editor Requirement
      2. 5.3.2. The error_handling Requirement
      3. 5.3.3. The picture_load_and_save Requirement
      4. 5.3.4. The image_crop Requirement
      5. 5.3.5. The image_rotate Requirement
      6. 5.3.6. The image_flip Requirement
      7. 5.3.7. The image_format Requirement
      8. 5.3.8. The platform_os Requirement
    4. 5.4. Design of the Photo Editor Application
      1. 5.4.1. Brief Introduction to UML Class Diagrams
        1. Class Relationships
      2. 5.4.2. Design of the Photo Editor Application
    5. 5.5. The Detailed Project Schedule
    6. 5.6. Implementation of the Photo Editor Application
      1. 5.6.1. The Basic Photo Editor Application
        1. Creating a Basic Application
      2. 5.6.2. Using Version Control
      3. 5.6.3. The Exception-Handling Application Block
      4. 5.6.4. Customized Exception Handling
      5. 5.6.5. Loading an Image
      6. 5.6.6. Scrolling and Basic Image Operations
      7. 5.6.7. Refactoring of the Current Code
      8. 5.6.8. Creating a Custom Control for Smooth Scrolling
      9. 5.6.9. Implementation of CustomScrollableControl
      10. 5.6.10. Configuring the Custom Control for Use in Visual Studio.NET
      11. 5.6.11. Cropping an Image
      12. 5.6.12. Rotate and Flip an Image
      13. 5.6.13. Save an Image
    7. 5.7. Unit Tests
      1. 5.7.1. The NUnit Test Framework
      2. 5.7.2. Unit Test Implementation
    8. 5.8. Conclusion
      1. 5.8.1. Review
    9. 5.9. References for Further Reading
        1. UML
        2. .NET Programming
        3. The NUnit Test Framework
  11. 6. GDI+ Graphics Extensions
    1. 6.1. Requirements for the GDI+ Extensions
    2. 6.2. Analysis of the GDI+ Extensions Requirements
      1. 6.2.1. The photo_editor Requirement
      2. 6.2.2. The image_graphics_annotations Requirement
      3. 6.2.3. The image_text_annotations Requirement
    3. 6.3. Design of the GDI+ Extensions
      1. 6.3.1. Using Design Patterns
        1. Using the Composite and Iterator Design Patterns
    4. 6.4. Project Management Issues
      1. 6.4.1. Schedule Issues
      2. 6.4.2. Reported Defects
    5. 6.5. GDI+ Programming
      1. 6.5.1. What Is GDI+?
      2. 6.5.2. GDI+ Namespaces
      3. 6.5.3. The Basics of GDI+
        1. The Drawing Surface
        2. The Coordinate System
        3. GDI+ Pens and Brushes
    6. 6.6. Drawing GDI+ Primitives
      1. 6.6.1. The Infrastructure Implementation
        1. Defining the Abstract GraphicsComponent Class
      2. 6.6.2. Drawing GDI+ Graphics Primitives: Lines, Rectangles, and Ellipses
      3. 6.6.3. Handling Mouse Events and Interactive Drawing
        1. Delegates and Events
        2. Implementing Event Handlers for Interactive Drawing
      4. 6.6.4. Drawing Text in GDI+
      5. 6.6.5. The Region of Interest, Erase, Reset, and Apply Functionality
      6. 6.6.6. Debugging and Defect Resolution
    7. 6.7. Unit Tests
    8. 6.8. Conclusion
      1. 6.8.1. Review
    9. 6.9. References for Further Reading
  12. 7. Advanced GDI+ Operations
    1. 7.1. Advanced GDI+ Extensions
    2. 7.2. Analysis of the Advanced GDI+ Extensions Requirements
      1. 7.2.1. The photo_editor Requirement
      2. 7.2.2. The image_graphics_annotations Requirement
      3. 7.2.3. The image_graphics_special_effects Requirement
    3. 7.3. Design of the Advanced GDI+ Extensions
    4. 7.4. Project Management Issues
      1. 7.4.1. Request for Additional Features
        1. Feature Trading (Resolution Proposal 1)
        2. Deadline Extension (Resolution Proposal 2)
        3. Rescheduling (Resolution Proposal 3)
      2. 7.4.2. Resolution of the Request
    5. 7.5. Using Pens and Brushes in GDI+
      1. 7.5.1. Color in GDI+: Using the RGB and ARGB Formats
        1. The Alpha Component
        2. The RGB Components
        3. Pixel Size as a Measure of Bits Per Pixel
      2. 7.5.2. More on Pens and Brushes
        1. Brushes
        2. Pens
      3. 7.5.3. The GraphicsPath Class
      4. 7.5.4. The Region Class
    6. 7.6. Implementation of Regions, Pens, and Brushes
      1. 7.6.1. Using Regions for the Frame Implementation
        1. The Ellipsoidal Frame Implementation
        2. Wiring the GUI Event Handlers and the New Components Together
    7. 7.7. Unit Tests
    8. 7.8. Conclusion
      1. 7.8.1. Review
    9. 7.9. References for Further Reading
  13. 8. Dynamic Loading of Components
    1. 8.1. Requirements for Image Postprocessing Components
    2. 8.2. Analysis of the Image Postprocessing Requirements
      1. 8.2.1. The photo_editor Requirement
      2. 8.2.2. The image_brightness Requirement
      3. 8.2.3. The image_contrast_and_color Requirement
      4. 8.2.4. The image_special_effects Requirement
    3. 8.3. Design of the Image-Processing Components Using Late Binding
      1. 8.3.1. Design of the Language Extension Components
    4. 8.4. Project Management Issues
      1. 8.4.1. Improving Project Visibility
    5. 8.5. Implementing Dynamically Loadable Image Postprocessing Plugins
      1. 8.5.1. Late Binding and Reflection
        1. Loading an Assembly at Run Time
        2. Member Invocation at Run Time
      2. 8.5.2. Adding a PictureBox for Previewing Image Operations
      3. 8.5.3. Implementation of a TrackBar Control
      4. 8.5.4. The Language-Independent Plugin Implementation
        1. Using Luminance to Translate an RGB Color into a Grayscale Image
        2. The C++ Contrast Plugin
        3. Using the Histogram Calculation in the Contrast Functionality
        4. The Implementation of the Contrast Plugin
        5. The Apply and Reset Buttons
        6. The Brightness Plugin Implementation Using J#
        7. The Color Correction Plugin Using Visual Basic
        8. The Red Eye Removal Tool
    6. 8.6. Unit Tests
      1. 8.6.1. The Contrast Plugin Unit Test
      2. 8.6.2. The Color Plugin Unit Test
      3. 8.6.3. The Red Eye Plugin Unit Test
    7. 8.7. Conclusion
      1. 8.7.1. Review
    8. 8.8. References for Further Reading
        1. Reflection
        2. Image Processing
  14. 9. Accessing System Resources
    1. 9.1. Refining Requirements for 3D Text Display
    2. 9.2. Three-Dimensional Rendering Technologies
      1. 9.2.1. GDI+ and DirectX
      2. 9.2.2. OpenGL
      3. 9.2.3. Software versus Hardware Rendering
    3. 9.3. Analyzing User Interface Needs
    4. 9.4. Using OpenGL.NET
      1. 9.4.1. Rendering Three-Dimensional Text with OpenGL
      2. 9.4.2. Three-Dimensional Text DLL Interfaces
    5. 9.5. Adding 3D Text to the Photo Editor Application
      1. 9.5.1. The 3D Text DLL Extension
        1. OpenGL Window and Rendering Context
        2. OpenGL Font Creation
        3. Rendering 3D Text
        4. Exporting API Functions
      2. 9.5.2. Using PInvoke to Integrate the 3D Text DLL into .NET
        1. Writing a Wrapper Class
      3. 9.5.3. First 3D Text: A Unit Test
      4. 9.5.4. Implementing the User Interface
    6. 9.6. Conclusion: Don't Reinvent the Wheel
    7. 9.7. References for Further Reading
        1. OpenGL
  15. 10. Performance Optimization, Multithreading, and Profiling
    1. 10.1. Requirements for Performance Optimization
    2. 10.2. Analysis of the Editor Optimization Requirement
      1. 10.2.1. Profiling the Photo Editor Application
      2. 10.2.2. Optimization Possibilities and Prototyping
    3. 10.3. Design of the Optimizations
      1. 10.3.1. Performance Optimization Options
      2. 10.3.2. Multithreading and Symmetric Multiprocessing
      3. 10.3.3. Design of the Multithreaded GUI
        1. Race Conditions
        2. Deadlocks
        3. Design of the Multithreading Feature
        4. State Chart of the Lock Scenario
    4. 10.4. Project Management Issues
      1. 10.4.1. Relation of Project Scope, Cost, Quality, and Time
      2. 10.4.2. Early Delivery Possibilities
        1. Reduced Quality (Resolution Proposal 1)
        2. Reduced Scope (Resolution Proposal 2)
        3. Release as Planned (Resolution Proposal 3)
      3. 10.4.3. Other Actions
    5. 10.5. Multithreading and Optimization Implementation
      1. 10.5.1. Prototyping Solutions for Performance Optimization
      2. 10.5.2. Implementing the Contrast Plugin Using Pointer Arithmetic for Pixel Access
      3. 10.5.3. Multithreading Implementation to Increase GUI Responsiveness
      4. 10.5.4. Using Thread Pools and Locks
        1. Using a Mutex for Synchronization
        2. Mutex and Delegate Implementation
        3. ThreadPool Implementation and Application Adaptation
    6. 10.6. Unit Tests
    7. 10.7. Conclusion
      1. 10.7.1. Review
    8. 10.8. References for Further Reading
        1. Profiling Tools
        2. Performance Analysis
        3. Multithreading
  16. 11. Building the Web Application with ASP.NET
    1. 11.1. Online Store Requirements
    2. 11.2. Analyzing Interfaces and Activities
      1. 11.2.1. The XML Product Catalog
      2. 11.2.2. Online Store Activities
      3. 11.2.3. Web Forms
    3. 11.3. Breakdown of the Code Modules
      1. 11.3.1. The Product Parser
      2. 11.3.2. The Shopping Cart
      3. 11.3.3. Web Forms
      4. 11.3.4. Calculators
    4. 11.4. Implementation of Online Photo Shop
      1. 11.4.1. Creating a New Web Application
      2. 11.4.2. Parsing the XML Product Catalog
        1. Reading the Product List
        2. Checking Progress through Informal Testing
        3. Finding Product Options
        4. Extracting the Product Details
        5. Adding Unit Tests
      3. 11.4.3. The Online Shop Portal
      4. 11.4.4. The Shopping Cart
        1. Serialization for the ASP.NET State Server
        2. The ShoppingCart Class
        3. Configuring the Web Application
        4. Shopping Cart Unit Tests
        5. Integration of the Shopping Cart into the Product Browser
        6. Shopping Cart Web Page
    5. 11.5. Conclusion
    6. 11.6. Reference for Further Reading
        1. ASP and XML
  17. 12. Security and Database Access
    1. 12.1. Secure Checkout
    2. 12.2. Integrating Externally Supplied Software
      1. 12.2.1. Validation of Externally Supplied Software Products
        1. Technology and Cost Analysis
        2. Validation of External Software Packages
        3. Integration of a Third-Party Product
    3. 12.3. E-mail, Password, Credit Card: Creating a Customer Profile
      1. 12.3.1. User Interfaces
      2. 12.3.2. Database Records
      3. 12.3.3. Tax and Shipping
      4. 12.3.4. Finalizing an Order
    4. 12.4. Secure Web Applications
      1. 12.4.1. Authentication
      2. 12.4.2. Authorization
      3. 12.4.3. Encryption
    5. 12.5. Database Access with ADO.NET
    6. 12.6. Putting It All Together
      1. 12.6.1. Creating the Data Source
      2. 12.6.2. The Data Access Layer
        1. The CustomerDB Class
        2. The OdbcCustomerDB Class
        3. Testing Database Access
      3. 12.6.3. The Database Singleton
      4. 12.6.4. The Login Page
      5. 12.6.5. The Checkout Form
        1. Tax and Shipping Cost
        2. Computing the Order Total
        3. Finalizing the Order
    7. 12.7. No Longer under Construction
    8. 12.8. References for Further Reading
        1. ADO
        2. SSL
        3. SQL
        4. Office Suite
  18. 13. Product Release
    1. 13.1. Deployment
      1. 13.1.1. Options for Distributing .NET Applications
      2. 13.1.2. Creating a Setup Program
      3. 13.1.3. Deploying Web Applications
      4. 13.1.4. Online Photo Shop Installation Notes
        1. Prerequisites
        2. Installation
    2. 13.2. Integration Test
      1. 13.2.1. Test Automation
      2. 13.2.2. Creating a Test Book
    3. 13.3. Requirements Tracing
    4. 13.4. Software Maintenance
      1. 13.4.1. Change Request Management
      2. 13.4.2. Maintenance Strategies
    5. 13.5. Wrap-Up
      1. 13.5.1. Project Planning
      2. 13.5.2. Requirements Refinement and Customer Feedback
      3. 13.5.3. Prototyping
      4. 13.5.4. Use of Unified Modeling Language and Design Patterns
      5. 13.5.5. Documentation
      6. 13.5.6. Automated Testing
      7. 13.5.7. Error Handling through Exceptions
      8. 13.5.8. Designing for Extensibility
      9. 13.5.9. Code Reuse
    6. 13.6. References for Further Reading
        1. Test Automation
        2. Bug Tracking Tools
  19. CD-ROM Warranty