Mickey Gousset, Brian Keller, Ajoy Krishnamoorthy, Martin Woodward
Wrox
Programmer to Programmer™
Join the discussion @
p2p.wrox.com
Professional
Application Lifecycle
Management
Get more out of
wrox.com
Programmer to Programmer
™Interact
Take an active role online by participating in our
P2P forums @ p2p.wrox.com
Wrox Online Library
Hundreds of our books are available online
through Books24x7.com
Wrox Blox
Download short informational pieces and code
to keep you up to date and out of trouble!
Join the Community
Sign up for our free monthly newsletter at
newsletter.wrox.com
Browse
Ready for more Wrox? We have books and
e-books available on .NET, SQL Server, Java,
XML, Visual Basic, C#/ C++, and much more!
Contact Us.
We always like to get feedback from our readers. Have a book idea?
PROFESSIONAL
APPLICATION LIFECYCLE MANAGEMENT
WITH VISUAL STUDIO
®
2010
INTRODUCTION . . . xxix
PART I
ARCHITECT
CHAPTER 1 Introduction to Software Architecture . . . 3CHAPTER 2 Top-down Design with Use Case Diagrams, Activity Diagrams, and Sequence Diagrams . . . .17
CHAPTER 3 Top-down Design with Component and Class Diagrams . . . 33
CHAPTER 4 Analyzing Applications Using Architecture Explorer . . . 59
CHAPTER 5 Using Layer Diagrams . . . .81
PART II
DEVELOPER
CHAPTER 6 Introduction to Software Development . . . 95CHAPTER 7 Unit Testing with the Unit Test Framework . . . 99
CHAPTER 8 Managed Code Analysis and Code Metrics . . . 139
CHAPTER 9 Profi ling and Performance . . . 167
CHAPTER 10 Database Development, Testing, and Deployment . . . 201
CHAPTER 11 Introduction to IntelliTrace . . . 243
PART III TESTER
CHAPTER 12 Introduction to Software Testing . . . 259CHAPTER 13 Web Performance and Load Testing . . . 277
CHAPTER 14 Manual Testing . . . 319
CHAPTER 15 Coded User Interface Testing . . . 339
CHAPTER 16 Lab Management . . . 357
Continues
⊲
⊲
PART IV TEAM FOUNDATION SERVER
CHAPTER 17 Introduction to Team Foundation Server . . . 379
CHAPTER 18 Team Foundation Architecture . . . 405
CHAPTER 19 Team Foundation Version Control . . . 423
CHAPTER 20 Branching and Merging . . . 447
CHAPTER 21 Team Foundation Build . . . .471
PART V
PROJECT/PROCESS MANAGEMENT
CHAPTER 22 Introduction to Project Management . . . 521CHAPTER 23 Process Templates . . . 549
CHAPTER 24 Using Reports, Portals, and Dashboards . . . 571
CHAPTER 25 Agile Planning Using Planning Workbooks . . . 599
CHAPTER 26 Process Template Customizations . . . 615
INDEX . . . 633
⊲
PROFESSIONAL
Application Lifecycle Management
PROFESSIONAL
Application Lifecycle Management
with Visual Studio® 2010
Mickey Gousset
Brian Keller
Ajoy Krishnamoorthy
Professional Application Lifecycle Management with Visual Studio® 2010
Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com
Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-48426-5
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 specifi cally disclaim all warranties, including without limitation warranties of fi tness 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 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 Control Number: 2010921244
This book is dedicated to my wife, Amye Gousset.
Once again, I scratched the itch to write, and once
again, she provided me all the love and support I
needed to make it happen. Amye, I love you more and
more each day.
— Mickey Gousset
This book is dedicated to my parents, Ray and Sue
Ellen Keller, who laid the foundation for me to
embark upon a lifetime of learning and a love of
technology. As a kid, they let me hijack the family
computer to teach myself how to program, and as a
young adult, they gave me the inspiration to explore
my passions, and the freedom to learn from my
failures. Mom and Dad, I love you.
— Brian Keller
I dedicate this book to my best friend and my wife,
Vidhya, and our wonderful children, Atul and Aditi.
Thank you for everything.
— Ajoy Krishnamoorthy
To Catherine, William, and Jamie.
ABOUT THE AUTHORS
MICKEY GOUSSET is a Senior Technical Developer for Infront Consulting Group, a consulting company focused on the Microsoft System Center family of products. He has been a Microsoft Team System MVP fi ve years running, a certifi ed professional in Team Foundation Server and SCOM 2007, and co-author (along with Jean-Luc David and Erik Gunvaldson) of the book Professional Team Foundation Server (Indianapolis: Wiley, 2006). Gousset runs “Team System Rocks!” (http://www.teamsystemrocks .com), a community site devoted to Visual Studio Team System and Visual Studio 2010, where he also blogs about Visual Studio and Team Foundation Server. He is also a co-host of the popular Team Foundation Server podcast, “Radio TFS” (http://www.radiotfs.com). He has spoken on Visual Studio and Team Foundation Server topics at various user groups, code camps, and conferences, including Microsoft Tech Ed Developer — North America 2008 and 2009. When not writing or working with computers, Mickey enjoys a range of hobbies, from playing on Xbox Live (“Gamer Tag: HereBDragons”) to participating in local community theater. Nothing beats his favorite pastime though — sitting on his couch with his lovely wife Amye, and their two Chihuahuas, Lucy and Linus.
BRIAN KELLER is a Senior Technical Evangelist for Microsoft, specializing in Visual Studio and application lifecycle management. Keller has been with Microsoft since 2002, and has presented at conferences all over the world, including TechEd, Professional Developers Conference (PDC), and MIX. Keller is also a regular personality on MSDN’s Channel 9 Web site, and is co-host of the popular show, “This Week on Channel 9.” Outside of work, he can usually be found enjoying the great outdoors while either rock climbing, backpacking, skiing, or surfi ng.
AJOY KRISHNAMOORTHY is a Senior Product Manager in the Microsoft Patterns and Practices group. In this role, he focuses on planning the areas of investments and business strategy for Patterns and Practices. Prior to this role, Krishnamoorthy worked as a Senior Product Manager for Microsoft Visual Studio Team System. He has more than ten years of consulting experience, playing variety of roles, including developer, architect, and technical project manager. Krishnamoorthy has written articles for online and printed magazines, and co-authored several books on ASP.NET. You can check out his blog at http://blogs.msdn.com/ajoyk. Krishnamoorthy has an MBA from Ohio State University. Any spare time is spent with his family, playing board/card games with friends, watching sports (especially when the Ohio State Buckeyes are playing), and learning to play “Tabla.”
CREDITS
EXECUTIVE EDITOR
Robert Elliott
DEVELOPMENT EDITOR
Kevin Shafer
TECHNICAL EDITORS
Siddharth Bhatia Justin Marks Peter Provost Mario Rodriguez Clark Sell David Williamson
PRODUCTION EDITOR
Rebecca Anderson
COPY EDITOR
Christopher Jones
EDITORIAL DIRECTOR
Robyn B. Siesky
EDITORIAL MANAGER
Mary Beth Wakefi eld
ASSOCIATE DIRECTOR OF MARKETING
David Mayhew
PRODUCTION MANAGER
Tim Tate
VICE PRESIDENT AND EXECUTIVE GROUP PUBLISHER
Richard Swadley
VICE PRESIDENT AND EXECUTIVE PUBLISHER
Barry Pruett
ASSOCIATE PUBLISHER
Jim Minatel
PROJECT COORDINATOR, COVER
Lynsey Stanford
COVER DESIGNER
Michael E. Trent
COVER PHOTO
© Ben Blankenburg/istockphoto
PROOFREADERS
Scott Klemp, Maraya Cornell, Carrie Hunter, Word One
INDEXER
ACKNOWLEDGMENTS
FIRST OFF, I WANT TO THANK AJOY, BRIAN, AND MARTIN for taking this journey with me. You have been incredible people to work with, and have truly made this a great experience. I’d like to thank everyone at Wiley and Wrox, specifi cally Bob Elliot and Kevin Shafer, our editors. This book could not have happened without their help and constant attention to detail. We also had some amazing people doing technical edits on this book, including Clark Sell, Peter Provost, Siddharth Bhatia, Mario Rodriguez, Justin Marks, David Williamson, and I’m sure many other names that I’ve overlooked. To everyone who has helped to make this book the great product that it is, I thank you. Finally, a big thank you to my family for your understanding, love, and support during the late nights and long weekends when I disappeared into my offi ce to write.
— Mickey Gousset
THE EFFORTS OF SO MANY PEOPLE went into the realization of this book that it’s hard to know where to begin. Perhaps most fundamentally is the work of the engineering team within Microsoft’s developer division, who have an insatiable drive for shipping great software that helps other software development teams around the world realize their full potential. Visual Studio 2010 is an incredibly exciting release, and is the inspiration for this book. David Williamson was the primary technical reviewer for the chapters I contributed, and his thoughtful suggestions contributed greatly to the quality of this book. I also received help from Anutthara Bharadwaj, Daryush Laqab, Ed Glas, Euan Garden, Gautam Goenka, Habib Heydarian, Katrina Lyon-Smith, Mark Mydland, Michael Rigler, Tanuj Vohra, Ted Malone, Vinod Malhotra, and scores of others over the last year and a half. Finally, I would like to thank our publisher and my co-authors, who I am proud to share this accomplishment with.
—Brian Keller
I OWE A BIG THANKS TO MY good friend Jean-Luc David for his persistence in getting me to work on this book. I was fortunate to have the chance to work with a talented team of fellow authors. Mickey, Brian and Martin, thank you, and I truly enjoyed working with you on this book.
Several members of the Visual Studio team offered their help, and I am thankful for that. I owe a lot of gratitude to Aaron Bjork, Siddharth Bhatia, John Socha-Leialoha, Sunder Raman, David Brokaw, Gokula Thilagar, Habib Heydarian, Justin Marks, and Brad Sullivan. They were all busy shipping a product, but never hesitated to help me when I reached them with questions, or needed more information and access to pre-release bits. Thanks to every one of you for your timely help.
Finally, I can’t thank my family enough for allowing me to spend countless hours during evenings and weekends on this book. Vidhya, Atul, and Aditi, none of this would have been possible without your encouragement, support, and understanding. I have missed several rounds of board games, trips to the play area, bed-time routines, and more. I promise you that I will do the best to make up for the lost time. Thank you for everything.
— Ajoy Krishnamoorthy
I WOULD LIKE TO ACKNOWLEDGE THE HELP, advice, and assistance from the people both inside and outside the Visual Studio team at Microsoft. Special thanks go to Aaron Hallberg, Brian Randell, Buck Hodges, Clark Sell, Jim Lamb, Julie MacAller, Mario Rodriguez, Matthew Mitrik, and William Bartholomew, without whom my contributions to this book would not have been possible. Thanks also to Rob Caron, Jeff Beehler, Brian Harry, Doug Neumann, Eric Sink, and Corey Steffen for encouraging my involvement in the Visual Studio community over the past fi ve years.
I would like to thank my co-authors for bringing me into this project, and for helping me fulfi ll a lifetime ambition of writing a book. I would also like to thank my dad, Roy Woodward, and my much missed mum, Val Woodward. They got me started down this whole computing path by getting me a Vic-20 at the age of 6, and got me a typewriter at the age of 8. With that sort of start, you’d think I’d have written a computer book at the age of 10, but instead I re-wrote “Ghostbusters” and co-authored a novel about a pink sofa. Well Mum — I got there in the end.
Last but not least, I would also like to thank my wife, Catherine, for her encouragement and support, and for helping me fi nd the time to write this book in our already busy lives. She has heard the phrase, “I’m nearly done, just fi nishing this last bit up,” more times than anyone deserves, yet, bizarrely, has still not fi gured out that she is way out of my league.
CONTENTS
INTRODUCTION xxix
PART I: ARCHITECT
CHAPTER 1: INTRODUCTION TO SOFTWARE ARCHITECTURE 3
Designing Visually
3
Microsoft’s Modeling Strategy
4
Understanding Model-Driven Development 5
Understanding Domain-Specifi c Languages 6
From Objects to Services
7
Understanding Objects and Compile-Time Reuse 7
Understanding Components and Deploy-Time Reuse 8
Understanding Distributed Components and Run-Time Reuse 9 Distributed Services and the Service-Oriented Architecture 10
New Architecture Tools in Visual Studio 2010 Ultimate
10
Use Case Diagrams 11
Activity Diagrams 11
Sequence Diagrams 12
Component Diagrams 13
Class Diagrams 13
Layer Diagrams 13
Architecture Explorer 14
Summary 15
CHAPTER 2: TOP-DOWN DESIGN WITH USE CASE DIAGRAMS,
ACTIVITY DIAGRAMS, AND SEQUENCE DIAGRAMS 17
Use Case Diagrams
18
Understanding a Use Case Diagram 18
Use Case Diagram Toolbox 20
Creating a Use Case Diagram 20
Activity Diagrams
22
Understanding an Activity Diagram 22
xvi CONTENTS
Creating an Activity Diagram 26
Adding an Activity Diagram to a Use Case Diagram 27
Sequence Diagrams
28
Understanding Sequence Diagrams 28
Sequence Diagram Toolbox 29
Creating a Sequence Diagram 30
Summary 31
CHAPTER 3: TOP-DOWN DESIGN WITH COMPONENT
AND CLASS DIAGRAMS 33
Component Diagrams
34
Understanding a Component Diagram 34
Component Diagram Toolbox 36
Component Diagram Element Properties 37
Creating a Component Diagram 38
Showing Internal Component Parts 43
Class Diagrams
46
Understanding a Class Diagram 47
Class Diagram Toolbox 48
Class Diagram Type Properties 49
Class Diagram Attribute Properties 51
Class Diagram Operations Properties 52
Class Diagram Association Properties 53
Creating a Class Diagram 55
Summary 58
CHAPTER 4: ANALYZING APPLICATIONS USING
ARCHITECTURE EXPLORER 59
Understanding the Code Base
60
Architecture Explorer Basics
61
Understanding the Architecture Explorer Window 61
Architecture Explorer Options 62
Navigating Through Architecture Explorer 62
Exploring Options for Namespaces 64
Exploring Options for Classes 66
Exploring Options for Members 68
Architecture Explorer Queries 69
Dependency Graphs
71
Creating the First Dependency Graph 71
Creating a Dependency Graph without Architecture Explorer 73
Navigating Through Your Dependency Graph 74
CONTENTS
Dependency Graph Toolbar 78
Summary 80
CHAPTER 5: USING LAYER DIAGRAMS 81
Creating a Layer Diagram
82
Defi ning Layers on a Layer Diagram
83
Creating a Layer for a Single Artifact 84
Adding Multiple Objects to a Layer Diagram 84
The Layer Explorer 85
Defi ning Dependencies
86
Validating the Layer Diagram
88
Layer Diagrams and the Build Process
90
Summary 91
PART II: DEVELOPER
CHAPTER 6: INTRODUCTION TO SOFTWARE DEVELOPMENT 95
What’s New for Developers in Visual Studio 2010
96
Test Impact Analysis
97
Improved Code Analysis
97
Profi ler Enhancements
97
Database Extensibility
97
Advanced Debugging with IntelliTrace
98
Improved “Test-First” Development Experience
98
Summary 98
CHAPTER 7: UNIT TESTING WITH THE UNIT TEST FRAMEWORK 99
Unit Testing Concepts
100
Benefi ts of Unit Testing 100
Writing Eff ective Unit Tests 101
Third-Party Tools 102
Visual Studio Unit Testing
102
Creating Your First Unit Test 103
Managing and Running Unit Tests 106
Test Run Confi guration 108
Test Results 109
Debugging Unit Tests 109
Programming with the Unit Test Framework
110
Initialization and Cleanup of Unit Tests 110
xviii CONTENTS
Using the CollectionAssert class 116
Using the StringAssert class 118
Expecting Exceptions 119
Defi ning Custom Unit Test Properties 119
TestContext Class 120
Creating Data-Driven Unit Tests 121
Accessing Nonpublic Members from Tests
122
Using PrivateObject to Access Nonpublic Instance Members 123 Using PrivateType to Access Nonpublic Static Members 125
Code Generation
126
Generating Tests from Code 126
Code Coverage
129
Enabling Code Coverage 130
Viewing Code Coverage Results 130
Test Impact Analysis
131
Prerequisites for Test Impact Analysis 132
Identifying Relationships Between Code and Tests 133
Test Impact Analysis Example 133
Summary 137
CHAPTER 8: MANAGED CODE ANALYSIS AND CODE METRICS 139
The Need for Analysis Tools
140
Using Managed Code Analysis
140
Built-in Managed Code Analysis Rules 142
Code Analysis Rule Sets 143
Enabling Managed Code Analysis 144
Executing Static Code Analysis 146
Working with Rule Violations 147
Using the Command-Line Analysis Tool
151
FxCopCmd Options 151
FxCopCmd Project Files 154
Build Process Code Analysis Integration 155
Creating Code Analysis Rules
155
Refl ection and Introspection 155
Creating a New Rule 156
Code Metrics
163
Summary 165
CHAPTER 9: PROFILING AND PERFORMANCE 167
CONTENTS
Types of Profi lers 168
Visual Studio Profi ling 169
Using the Profi ler
169
Creating a Sample Application 169
Creating a Performance Session 171
Using the Performance Explorer 173
Confi guring a Sampling Session 182
Confi guring an Instrumentation Session 184
Confi guring a .NET Memory Allocation Session 184
Confi guring a Concurrency Profi ling Session 185
Executing a Performance Session 185
Managing Session Reports 186
Reading and Interpreting Session Reports 187
Command-Line Profi ling Utilities
195
Virtual Machines 196
Profi ling JavaScript 196
Just My Code 198
Common Profi ling Issues
198
Debugging Symbols 198
Instrumentation and Code Coverage 199
Summary 199
CHAPTER 10: DATABASE DEVELOPMENT, TESTING,
AND DEPLOYMENT 201
The Challenges of Database Change Management
202
Offl
ine Schema Development
203
Taking the Schema Offl ine 204
Iterative Development 204
Schema Testing 205
Build and Deploy 206
Creating a Database Project
207
Examining the Database Project
212
Solution Explorer versus Schema View 213
Schema Dependency Viewer 213
T-SQL File Structure 214
Making Schema Changes
215
Editing T-SQL Files Directly 216
Detecting Schema Syntax Errors 216
Database Refactoring 217
T-SQL Script Templates 220
xx
CONTENTS
Data Generation
224
Data Generation Plan 224
Data Generators 226
Database Testing
227
Functions, Triggers, and Stored Procedures 227
Writing Advanced Database Unit Tests 230
Eff ective Database Testing 231
T-SQL Static Analysis 233
Additional Database Tools 236
Summary 241
CHAPTER 11: INTRODUCTION TO INTELLITRACE 243
Debugging Using IntelliTrace
243
Debugging Options 244
Events Recording 247
Debugging and Playback 248
New Features in Breakpoints
251
Sharing Breakpoints 251
Labeling Breakpoints 252
Pinnable Data Tips
253
Summary 255
PART III: TESTER
CHAPTER 12: INTRODUCTION TO SOFTWARE TESTING 259
Role-Based Testing Tools
260
Types of Tests
260
Diagnostic Data Adapters
262
Microsoft Test Manager
264
Managing Automated Tests with Visual Studio
265
Test Projects 265
Using Test Categories 267
Working with Test Results 269
Using Ordered Tests 272
Test Settings 274
Test Impact View 275
Summary 276
CHAPTER 13: WEB PERFORMANCE AND LOAD TESTING 277
CONTENTS
Web Performance Tests Versus Coded UI Tests 278
Creating a Sample Web Application 279
Creating Users for the Site 279
Creating and Confi guring Web Tests 281
Recording a Web Performance Test 282
Confi guring Web Performance Test Run Settings 284
Parameterizing the Web Server 285
Test Settings 285
Running a Web Performance Test 287
Observing Test Execution and Results 287
Editing a Web Performance Test 289
Data-Driven Web Performance Tests 293
Coded Web Performance Tests 294
Load Tests
297
Creating and Confi guring Load Tests 297
Editing Load Tests 306
Executing Load Tests 308
Viewing and Interpreting Load Test Results 308
Command-Line Test Execution
312
Executing Tests 313
Executing Test Lists 313
Other Test Options 313
Distributed Load Tests
313
Installing Controllers and Agents 314
Confi guring Controllers 314
Confi guring Agents 315
Test Settings 315
Running a Distributed Load Test 316
Viewing a Distributed Load Test 317
Summary 317
CHAPTER 14: MANUAL TESTING 319
Microsoft Test Manager
319
Using Test Plans
320
Confi guring Test Settings 322
Using Builds 323
Analyzing Impacted Tests 324
Defi ning Test Confi gurations 325
Using Plan Contents 326
Running Tests and Tracking Results
330
xxii CONTENTS
Supported Technologies 335
Saving Test Results 335
Running Automated Tests
336
Summary 338
CHAPTER 15: CODED USER INTERFACE TESTING 339
Creating Coded UI Tests Using the Coded UI Test Builder
340
Setting up the Sample Application 340
Create a Test Project 341
Add a Coded UI Test 341
Coded UI Test Builder 342
Generated Code 345
Running Your Test 347
Creating a Data-Driven Test 347
Using the using() Clause 349
Enhanced Assertion Reporting 350
Creating Coded UI Tests Using Action Recordings
351
Supported Technologies
354
Summary 354
CHAPTER 16: LAB MANAGEMENT 357
Lab Management Infrastructure
358
Golden Images 359
Agents 359
Virtual Environments
360
Testing with Virtual Environments
366
Create New Test Settings 366
Run Manual Tests with an Environment 369
Automated Build-Deploy-Test with Virtual Environments
371
Physical Environments
375
Summary 376
PART IV: TEAM FOUNDATION SERVER
CHAPTER 17: INTRODUCTION TO TEAM FOUNDATION SERVER 379
What Is Team Foundation Server?
380
Team Foundation Server Core Concepts
380
Team Foundation Application Tier 381
CONTENTS
Team Project 382
Process Template 385
Work Item Tracking 387
Version Control 388
Team Build 391
Accessing Team Foundation Server
392
Accessing Team Foundation Server from Visual Studio 392 Using the Team Foundation Server Administration Console 394 Accessing Team Foundation Server through a Web Browser 395 Using Team Foundation Server in Microsoft Excel 395 Using Team Foundation Server in Microsoft Project 397
Command-Line Tools for Team Foundation Server 397
Accessing Team Foundation Server from Eclipse 398
Windows Explorer Integration with Team Foundation Server 399 Access to Team Foundation Server via other Third-Party Integrations 400
What’s New in Team Foundation Server 2010
400
Project Management 400
Version Control 401
Build 401 Administration 402
Adopting Team Foundation Server
402
Hosting Team Foundation Server 402
Adoption Plan 403
Summary 404
CHAPTER 18: TEAM FOUNDATION ARCHITECTURE 405
Team Foundation Server Logical Architecture
406
Team Project Collections 408
Team Foundation Server Farm 410
Team Foundation Server Application 410
Team Foundation Server Instance 411
Physical Architecture
412
Hardware Requirements 412
Software Requirements 414
Deployment Scenarios
415
Individuals and Small Teams 416
Small Shops 416
Large Enterprises 417
Hosted Environments 418
Upgrading from Older Team Foundation Server Versions 420
xxiv CONTENTS
CHAPTER 19: TEAM FOUNDATION VERSION CONTROL 423
Team Foundation Version Control and Visual
SourceSafe (VSS) 2005
424
Setting up Version Control
425
Setting up Security Roles 425
Setting up Your Workspace 426
Using the Source Control Explorer
427
Workspaces 429
Adding Projects to the Source Repository 432
Check-In and Check-Out
432
Checking In an Item 433
Checking Out an Item 434
Creating and Administering Check-In Policies 435
Viewing History 436
Labeling Files 437
Shelving 438
Branching and Merging
440
Branching 440 Merging 443
Command-Line Tools
444
Summary 445
CHAPTER 20: BRANCHING AND MERGING 447
Understanding Branching and Merging
448
Software Confi guration Management 448
Basic Defi nitions 449
Common Branching Strategies
449
No Branching 449
Branch Per Release 450
Code Promotion Branching 451
Branch Per Feature 451
Basic Branching Plan
452
Scenario 453
The Plan 453
Implementation 454
Advanced Branching Plan
467
Scenario 468
The Plan 468
Implementation 469
CONTENTS
CHAPTER 21: TEAM FOUNDATION BUILD 471
Team Foundation Build
472
What’s New in Team Foundation Build 2010
474
Windows Workfl ow 4.0 474
Gated Check-ins 475
Private Builds 475
Build Controller 475
Build Notifi cations 476
Properties Exposed for Common Customizations 476
Integration with Symbol and Source Server 476
Enhanced Build Deletion Options 477
Team Foundation Build Architecture
477
Working with Builds
478
Team Explorer 479
Build Explorer 479
Build Details View 481
Creating a Build Defi nition 482
Queuing a Build 489
Build Notifi cations 491
Team Build Process
492
DefaultTemplate Process 493
Build Process Parameters 494
Customizing the Build Process 500
Summary 517
PART V: PROJECT/PROCESS MANAGEMENT
CHAPTER 22: INTRODUCTION TO PROJECT MANAGEMENT 521
Team Project Setup and Confi guration
522
Creating a Team Project 523
Connecting to the Team Foundation Server 527
Planning Your Project
528
All Things Work Items
529
Understanding a Work Item 529
Work Item Links and Link Types 531
Creating and Updating Work Items 534
Work Item Queries 535
Using MS Offi
ce with Team Foundation Server
538
Offi ce Project and Team Foundation Server 539
Offi ce Excel and Team Foundation Server 544
xxvi CONTENTS
CHAPTER 23: PROCESS TEMPLATES 549
Understanding a Process Template
550
Process Templates Out of the Box
551
MSF for Agile Software Development 551
MSF for CMMI Process Improvement v5.0 562
Partner and Community Templates
568
Summary 569
CHAPTER 24: USING REPORTS, PORTALS, AND DASHBOARDS 571
Team Foundation Server Reporting
572
Working with Team Foundation Server Reports
575
Tools to Create Reports 575
Working with Microsoft Excel Reports 576
Working with RDL Reports 585
Reports Out-of-the-Box 589
Project Portals and Dashboards 592
Summary 596
CHAPTER 25: AGILE PLANNING USING PLANNING WORKBOOKS 599
Product Backlog
600
Release Planning 600
Product Planning Workbook
602
Locating the Product Planning Workbook 602
Setting Up the Product Planning Workbook 602
Using the Product Backlog Worksheet 603
Using the Iterations Worksheet 606
Using the Interruptions Worksheet 607
Iteration Planning
607
Iteration Backlog Workbook
608
Locating the Iteration Backlog 608
Using the Iteration Backlog Worksheet 610
Using the Capacity Planning Worksheet 612
Tracking the Iteration
613
Issues 613 Retrospectives 614
CONTENTS
CHAPTER 26: PROCESS TEMPLATE CUSTOMIZATIONS 615
Customizing Process Templates
616
Downloading a Process Template to Your Desktop 616
What’s in a Process Template? 617
Process Template Plug-ins 618
Tools for Customization
620
XML Editor 620
witadmin Command-Line Utility 621
Process Template Editor 622
Uploading Process Templates in Team Foundation Server
631
Deleting Process Templates
631
Customizing Process Guidance
632
Summary 632
INTRODUCTION
IN JUNE 1999, MICROSOFT STARTED TO RE - EVALUATE HOW Visual Studio was being used as part of the software development process. Microsoft was continuing to serve the needs of an individual programmer through the highly productive “ code - focused rapid - application - development ” features of Visual Studio, but wasn ’ t doing much to help programmers work together as a team . And what about software architects — how should they be working with the programming team? And testers? Project managers?
Many teams had begun to set up their own solutions using a mixture of third - party, in - house, and vendor - provided tools to address such challenges as version control, bug tracking, and team communications. But this mishmash of tools can be tricky to set up and maintain, and even more diffi cult to integrate. Microsoft sought to address this challenge by providing an integrated set of tools designed to address the needs of the entire software development team. Thus, Visual Studio Team System was born, and was fi rst released with the Visual Studio 2005 product line.
Team System was built from a foundation of tools and technologies that Microsoft had been using internally for many years to build some of the most complex software projects ever undertaken. Team System appealed not only to programmers, but to all members of the development team — architects, application developers, database developers, testers, and project managers. Team System was built to address the entire software development lifecycle, more broadly known as application lifecycle management .
Three years later, Visual Studio 2008 Team System evolved from the previous version to include even more tools and functionality for all members of the project team to use.
THE NAME CHANGE
Observant readers will notice that nowhere in the title of this book do the words “ Team System ” appear. And, other than in the brief history you just fi nished reading, you won ’ t see the words “ Team System ” listed anywhere else in this book. So, what happened to “ Team System ” ?
Microsoft did some research and found that by creating two Visual Studio brand names, customers felt confused over the differences between the products. “ Visual Studio ” had been positioned as the basic tool for developers to use, while “ Visual Studio Team System ” was positioned as a set of tools for software development teams. However, almost all professional developers work on teams, and, hence, the term “ Team System ” was somewhat meaningless. So, the decision was made to drop the “ Team System ” name, and consolidate everything around a united Visual Studio brand family.
xxx
INTRODUCTION
TABLE I - 1: Visual Studio 2010 Product Lineup
PRODUCT NAME DESCRIPTION
Microsoft Visual Studio 2010 Ultimate with MSDN
The comprehensive suite of application lifecycle management tools for software teams to help ensure quality results from design to deployment.
Microsoft Visual Studio 2010 Premium with MSDN
A complete toolset to help developers deliver scalable, high - quality applications.
Microsoft Visual Studio 2010 Professional with MSDN
The essential tool for basic development tasks to assist developers in implementing their ideas easily.
Microsoft Visual Studio Test Professional 2010 with MSDN
The primary tool for manual and generalist testers who need to defi ne and manage test cases, execute test runs, and fi le bugs. The Test Professional product includes Microsoft Test Manager, which is introduced in Chapter 14.
Microsoft Visual Studio Team Foundation Server 2010
The server component for team development, version control, work item tracking, build automation, and reporting.
Microsoft Visual Studio Lab Management 2010 The tools to support virtual labs, and enable better developer and tester collaboration when paired with other Visual Studio tools.
VISUAL STUDIO 2010 PRODUCT LINEUP
Table I - 1 outlines the new product lineup for Visual Studio 2010.
Visual Studio 2010 Premium contains all the functionality of Visual Studio 2010 Professional, and Visual Studio 2010 Ultimate contains all the functionality of Visual Studio 2010 Premium. Visual Studio 2010 Ultimate also includes all of the functionality available in Visual Studio Test Professional 2010.
INTRODUCTION
VISUAL STUDIO EDITION FUNCTIONALITY
Microsoft Visual Studio 2010 Ultimate IntelliTrace
Unifi ed Modeling Language (UML)
Architecture Explorer
Logical class designer
Test case management
Manual testing
Test record and playback
Layer diagrams
Web performance testing
Load testing
Microsoft Visual Studio 2010 Premium Coded user interface (UI) testing
Performance profi ling
Code coverage
Database change management
Database unit testing
Test impact analysis
Static code analysis
Code metrics
Database deployment
Test data generation
Microsoft Visual Studio 2010 Professional Silverlight development
Web development
Windows Presentation Foundation (WPF) development
TABLE I-2: Visual Studio 2010 Editions
xxxii
INTRODUCTION
This book focuses on the functionality contained in Visual Studio 2010 Premium and Visual Studio 2010 Ultimate.
MODERN SOFTWARE DEVELOPMENT CHALLENGES
Software developers share common challenges, regardless of the size of their teams. Businesses require a high degree of accountability — software must be developed in the least amount of time, with no room for failure.
Some of these challenges include the following:
Integration problems — Most tools commonly used by software development teams come from third - party vendors. Integrating with those tools can pose a major challenge — in many cases, it requires duplicating or copying data into multiple systems. Each application has a learning curve, and transmitting information from one application to another (incompatible) application can be frustrating and time - consuming.
Geographically distributed teams — Many development and management tools don ’ t scale for geographically distributed teams. Getting accurate reporting can be diffi cult, and there is often poor support for communication and collaborative tools. As a result, requirements and specifi cations can be mapped incorrectly, causing delays and introducing errors. Global teams require solid design, process, and software confi guration management all integrated into one package. There aren ’ t many software packages that can deliver all these features, and those that do exist tend to be incredibly expensive.
Segmentation of roles — Specialization can be a huge problem on a team. Experts can assume that other departments are aware of information that doesn ’ t end up in the status reports, but may greatly affect the project as a whole. Interdepartmental communication is a huge and prevalent challenge.
Bad reporting — This is an offshoot of the segmentation problem. In most cases, reports must be generated manually by each team, which results in a lack of productivity. There ➤
➤
➤
➤
VISUAL STUDIO EDITION FUNCTIONALITY
Multi - core development
Cloud development
Windows Forms development
Offi ce development
INTRODUCTION
aren ’ t any effective tools that can aggregate all the data from multiple sources. As a result, the project lead lacks the essential data to make effective decisions.
Lack of process guidance — Ad hoc programming styles simply don ’ t scale. If you introduce an off - cycle change to the code, it can cascade into a serious problem requiring hours and days of work. Today ’ s software has a high level of dependencies. Unfortunately, most tools don ’ t incorporate or enforce process guidance. This can result in an impedance mismatch between tools and process.
Testing as a second - class citizen — Shorter cycles and lack of testing can introduce code defects late in the process. Manual testers are almost completely unaddressed by software development tools vendors. Consequently, poor collaboration between developers and testers often results in wasted back - and - forth effort and software defects.
Communication problems — Most companies use a variety of communication methods (such as email, instant messaging, memos, and sticky notes) to send information to team members. You can easily lose a piece of paper, or delete an important email message, if you are not careful. There aren ’ t many centralized systems for managing team communications. Frequent and time consuming status meetings are required to keep the team on track, and many manual processes are introduced (such as sending email, as well as cutting and pasting reports). Fundamentally, the problem is that there is no communication between the tools and the project leads.
Companies introduce methodologies and practices to simplify and organize the software design process, but these methodologies must be balanced. The goal is to make the process predictable, because in a predictable environment, methodologies keep projects on track. Conversely, methodologies add tasks to the process (such as generating reports). If your developers spend too much time doing these tasks, they ’ ll be less productive, and your company won ’ t be able to react competitively.
ENTER VISUAL STUDIO 2010
Application lifecycle management is the concept of managing your software development project throughout all phases of its life. Building upon Visual Studio 2005 Team System and Visual Studio 2008 Team System, the application lifecycle management capabilities of Visual Studio 2010 were designed to mitigate or eliminate many of these challenges.
There are three founding principles behind the application lifecycle management capabilities of Visual Studio 2010: productivity , integration , and extensibility .
Productivity is increased in the following ways:
Collaboration — Team Foundation Server centralizes all team collaboration. Bugs,
requirements, tasks, test cases, source code, and builds are all managed via Team Foundation Server 2010. All reporting is also centralized, which makes it easy for project leads to track the overall progress of the project, regardless of where the metrics are coming from.
Manage complexity — Software development projects are more complex than ever, and getting more complex year by year. Team Foundation Server helps to manage this complexity ➤
➤
➤
➤
xxxiv
INTRODUCTION
by centrally tracking your entire software development process, ensuring that the entire team can see the state and workfl ow of the project at any given time. Additionally, tools such as the architecture tools provided in Visual Studio 2010 Ultimate can help reduce the complexity of applications by providing designs that can be used to visually reverse - engineer existing code bases.
Integration is improved in the following ways:
Integrated tools — These facilitate communication between departments. More importantly, they remove information gaps. With the Visual Studio 2010 family of products, integration isn ’ t an afterthought — it ’ s a core design consideration for the toolset.
Visibility — Visual Studio 2010 and Team Foundation Server increase the visibility of a project. Project leads can easily view metrics related to the project, and can proactively address problems by identifying patterns and trends.
Extensibility is provided in the following ways:
Team Foundation Core Services API . — Most of the platform is exposed to the developer, providing many opportunities for extensibility and the creation of custom tools that integrate with Team Foundation Server.
IDE — The Visual Studio 2010 IDE itself is extensible, allowing third parties and end users to add everything from additional tool capabilities to even new language compilers to the development environment.
APPLICATION LIFECYCLE MANAGEMENT
To best demonstrate how Visual Studio 2010 can help in the process of application lifecycle management, let ’ s run through a typical scenario with a fi ctional software development company called eMockSoft. eMockSoft has recently signed a partnership with a distributor to release its catalog of products. The distributor has requested a secure Web service to transmit inventory and pricing information to internal and external partner organizations.
Let ’ s look at the scenario as it applies to application lifecycle management and the Visual Studio 2010 tools.
Requirements
The project manager meets with the sponsor to obtain requirements for the project. The requirements will inform the development team about what the project sponsor expects the software to deliver. The project manager can use a tool of choice (such as Visual Studio, Excel, or Microsoft Project) to store these requirements in Team Foundation Server. The project sponsor can validate and track these requirements using a SharePoint - based team project portal generated by Team Foundation Server. The team project portal surfaces reports and other artifacts stored in Team Foundation Server to a Web - based SharePoint site.
The infrastructure architect can now begin the system design. ➤
➤
➤
INTRODUCTION
System Design and Modeling
Based on the client specifi cations, the infrastructure architect can use the new UML tools in Visual Studio 2010 to defi ne the external Web service. Meanwhile, the project manager can track the progress of the designs, including the diagrams that were generated. Based on the specifi cations, the project manager can then break work down into tasks (also stored in Team Foundation Server) to be assigned to developers on the team.
Code Generation
The developer receives work assignments and reviews the UML diagrams that were designed by the architect. The developer checks the specifi cations — this application requires a secure Web service using Web Services Enhancements (WSE) 3.0. The developer writes the necessary code, and does some preliminary testing, using static code analysis and unit testing tools built into Visual Studio 2010. Throughout the day, the developer checks the code and tests into Team Foundation Server 2010.
Testing
The tester checks the progress of the development team by monitoring the nightly builds and automated tests. Using Visual Studio Lab Management 2010, each nightly build triggers the automatic creation of a virtual machine that is ready each morning for the tester to begin testing with. The tester uses Visual Studio Test Professional 2010 to author, manage, and execute a suite of manual test cases each day to surface potential bugs for the development team. The tester fi les a bug in Team Foundation Server that is assigned to the developer to fi x.
All bug reports are stored in Team Foundation Server, and provide team members and project sponsors with full visibility into the progress of the project.
Putting It into Context
This is a just simple example that examines just a few of the ways in which Visual Studio 2010 can assist with application lifecycle management. Throughout this book, you will discover other examples that can help your team become a more cohesive unit and ship better software.
WHO IS THIS BOOK FOR?
This book primarily targets teams of professionals in the fi eld of commercial or enterprise software development — in other words, intermediate to advanced users. You are likely to fi nd the book useful if you are any of the following:
A developer, tester, or architect who wants to learn how the Visual Studio 2010 family of products can help you perform your job
A project manager who must manage a software development project ➤
xxxvi
INTRODUCTION
This book is not designed for the absolute beginner. The focus is on practical application of the tools, code samples, and hands - on scenarios. The book ’ s organization makes it easy to use as both a step - by - step guide and a reference for modeling, designing, testing, and coordinating enterprise solutions at every level.
Visual Studio 2010 is designed for software teams of all sizes. So, whether you have a team of 5 or 2,000 members, this book includes useful information for you related to Visual Studio 2010 and application lifecycle management. Unlike most Wrox books, this book targets all roles in the software development organization — architects, developers, testers, project leads, and management — not just developers.
WHAT DOES THIS BOOK COVER?
This book includes a complete overview of the application lifecycle management capabilities of Visual Studio 2010. The book is divided into fi ve main parts, based around the different roles on the software development team:
Part I: Architect
Part II: Developer
Part III: Tester
Part IV: Team Foundation Server
Part V: Project/Process Management
Part I: Architect
This section of the book examines the tools available in Visual Studio 2010 related to the architect role. After a brief introduction to architecture concepts, the discussion dives into all the new UML tools available, including use case diagrams, activity diagrams, sequence diagrams, class diagrams, and component diagrams. You then learn about the Architecture Explorer and how it can be used to understand the architecture of your application. Finally, this section wraps up with a discussion of layer diagrams.
Part II: Developer
This section of the book covers all the topics of most interest to a developer who is creating an application with Visual Studio 2010. Unit testing, refactoring, static code analysis, and code coverage are all covered in detail. The capability to handle development, testing, and deployment of database applications is also covered, as are advanced application debugging techniques using the new IntelliTrace functionality.
➤
➤
➤
➤
INTRODUCTION
Part III: Tester
Visual Studio 2010 has numerous tools available for testers to use, and this section covers all of them. The examination starts out with a look at Web performance and load testing. After that, the new manual testing functionality is discussed, as well as the capability to automate user interface tests. This section concludes with a look the new lab management capabilities of Visual Studio 2010, which allow you to make use of virtual machines to automatically spin up test environments that can be used to execute tests.
Part IV: Team Foundation Server
This section is all about the capabilities that Team Foundation Server provides. It discusses the new architecture of Team Foundation Server 2010, and then delves into the version control system and some best practices surrounding branching and merging using Team Foundation Server. Finally, there is an in - depth look at some of the new changes to the automated build process, Team Foundation Build.
Part V: Project/Process Management
The fi nal section of the book deals with the Project and Process Management functionality of Visual Studio 2010 and Team Foundation Server. The new process templates that ship with the product are examined, along with the new backlog and capacity planning features. The reports that ship with Team Foundation Server also are examined. Finally, some of the more common process template customizations are shown.
CONVENTIONS
To help you get the most from the text and keep track of what ’ s happening, we ’ ve used a number of conventions throughout the book.
Boxes like this one hold important, not - to - be forgotten information that is directly relevant to the surrounding text.
Notes, tips, hints, and tricks are offset and placed in italics like this.
SIDEBAR
xxxviii
INTRODUCTION
As for styles in the text:
We highlight new terms and important words when we introduce them.
We show keyboard strokes like this: Ctrl+A.
We show fi lenames, URLs, and code within the text like so: persistence.properties .
We present code in two different ways:
We use a monofont type with no highlighting for most code examples.
We use boldface to emphasize code that is of particularly importance in the present context.
SOURCE CODE
As you work through the examples in this book, you may choose either to type in all the code manually, or to use the source code fi les that accompany the book. All the source code used in this book is available for download at www.wrox.com . Once at the site, simply locate the book ’ s title
(either by using the Search box, or by using one of the title lists) and click the Download Code link on the book ’ s detail page to obtain all the source code for the book.
Because many books have similar titles, you may fi nd it easiest to search by ISBN; this book’s ISBN is 978-0-470-48426-5.
Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download .aspx to see the code available for this book and all other Wrox books.
ERRATA
We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you fi nd an error in one of our books, such as a spelling mistake or a faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and you will be helping us provide even higher quality information.
To fi nd the errata page for this book, go to www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page, you can view all errata that has been submitted for this book and posted by Wrox editors. A complete book list, including links to each book ’ s errata, is also available at www.wrox.com/misc-pages/ booklist.shtml .
➤
➤
➤
INTRODUCTION
A complete book list including links to errata is also available at www.wrox.com/ misc-pages/booklist.shtml.
If you don ’ t spot “ your ” error on the Book Errata page, go to www.wrox.com/contact/
techsupport.shtml and complete the form there to alert us about the error you have found. We ’ ll
check the information and, if appropriate, post a message to the book ’ s errata page and fi x the problem in subsequent editions of the book.
P2P.WROX.COM
For author and peer discussion, join the P2P forums at http://p2p.wrox.com . The forums are a
Web - based system for you to post messages relating to Wrox books and related technologies, and to interact with other readers and technology users. The forums offer a subscription feature to email you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.
At http://p2p.wrox.com , you will fi nd several different forums that will help you not only as
you read the book, but also as you develop your own applications. To join the forums, just follow these steps:
1.
Go to http://p2p.wrox.com and click the Register link.
2.
Read the terms of use and click Agree.
3.
Complete the required information to join, as well as any optional information you wish to provide, and click Submit.
4.
You will receive an email message with information describing how to verify you account and complete the joining process.You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.
Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum emailed to you, click the “ Subscribe to this Forum ” icon by the forum name in the forum listing.
PART I
Architect
CHAPTER 1:
Introduction to Software Architecture
CHAPTER 2:
Top-Down Design with Use Case Diagrams,
Activity Diagrams, and Sequence Diagrams
CHAPTER 3:
Top-Down Design with Component and Class Diagrams
CHAPTER 4:
Analyzing Applications Using Architecture Explorer
CHAPTER 5:
Using Layer Diagrams
⊲
⊲
⊲
⊲
Introduction to Software
Architecture
WHAT ’ S IN THIS CHAPTER?
Why designing visually is important
Microsoft ’ s approach to a modeling strategy
Modeling tools in Visual Studio 2010 Ultimate
In this introductory chapter, you ’ ll learn about the main themes — domain - specifi c languages (DSLs), model - driven development (MDD), and the Unifi ed Modeling Language (UML) — and how they apply to the Visual Studio 2010 Ultimate. As part of this discussion, you ’ ll learn what Microsoft has to say on those subjects, as well as some impartial views from the authors.
This chapter examines the evolution of distributed computing architectures — from simple object - oriented development, through component and distributed - component design, to the service - oriented architectures (SOAs) — that represent the current state of the art.
This chapter wraps up with a brief glimpse at the new architecture tools in Visual Studio 2010. New modeling tools, as well as support for the most common Unifi ed Modeling Language diagrams, have been added to Visual Studio 2010, making the architecture tools fi rst - class citizens in the product.
Let ’ s begin by fi rst establishing the case for even undertaking visual modeling — or visual design — in the fi rst place.
DESIGNING VISUALLY
Two elementary questions immediately come to mind. Why design at all, rather than just code? Why design visually?
➤
➤
➤
4
❘
CHAPTER 1 INTRODUCTION TO SOFTWARE ARCHITECTURETo answer the fi rst question, consider the common analogy of building complex physical
structures, such as bridges. Crossing a small stream requires only a plank of wood — no architect, no workers, and no plans. Building a bridge across a wide river requires a lot more — a set of plans drawn up by an architect so that you can order the right materials, planning the work, communicating the details of the complex structure to the builders, and getting a safety certifi cate from the local authority. It ’ s the same with software. You can write a small program by diving straight into code, but building a complex software system will require some forethought. You must plan it, communicate it, and document it to gain approval.
Therefore, the four aims of visual design are as follows:
To help you visualize a system you want
To enable you to specify the structure or behavior of a system
To provide you with a template that guides you in constructing a system
To document the decisions you have made
Traditionally, design processes like the Rational Unifi ed Process have treated design and
programming as separate disciplines, at least in terms of tools support. You use a visual modeling tool for design, and a separate integrated development environment (IDE) for coding. This makes sense if you treat software development like bridge building, and assume that the cost of fi xing problems during implementation is much higher than the cost of fi xing those problems during design.
For bridges, that is undoubtedly true. But in the realm of software development, is it really more costly to change a line of code than it is to change a design diagram? Moreover, just as bridge designers might want to prototype aspects of their design using real materials, so might software designers want to prototype certain aspects of their design in real code.
For these reasons, the trend has been toward tools that enable visual design and coding within the same environment, with easy switching between the two representations, thus treating design and coding as essentially two views of the same activity. The precedent was set originally in the Java space by tools such as Together - J and, more recently, in the .NET space by IBM - Rational XDE, and this approach has been embraced fully by the Visual Studio 2010 Ultimate.
Now, let ’ s tackle the second question. If the pictorial design view and the code view are alternative but equivalent, representations, then why design visually at all? The answer to that question is simple: A picture paints a thousand words. To test that theory, just look at the fi gures in this chapter and imagine what the same information would look like in code. Then imagine trying to explain the information to someone else using nothing but a code listing.
MICROSOFT ’ S MODELING STRATEGY
As mentioned, Microsoft ’ s Visual Studio 2010 modeling strategy is based on a couple of ideas:
These topics together comprise Microsoft ’ s new vision for how to add value to the software development process through visual modeling.
First, let ’ s set the scene. The Object Management Group (OMG) has a licensed brand called
Model - Driven Architecture (MDA) . MDA is an approach to MDD based on constructing platform independent UML models (PIMs) supplemented with one or more platform - specifi c models (PSMs). Microsoft also has an approach to MDD, based not on the generic UML but rather on a set of tightly focused DSLs. This approach to MDD is part of a Microsoft initiative called software factories, which, in turn, is part of a wider Dynamic Systems Initiative.
If you would like a more in - depth exploration of software factories, check out the book, Software Factories:Assembling Applications with Patterns, Works, Models and Tools , written by Keith Short, Jack Greenfi eld, Steve Cook, and Stuart Kent (Indianapolis: Wiley, 2004).
Understanding Model - Driven Development
As a software designer, you may be familiar with the “ code - generation ” features provided by UML tools such as Rational Rose and IBM - Rational XDE. These tools typically do not generate “ code ” at all but merely “ skeleton code ” for the classes you devise. So, all you get is one or more source fi les containing classes populated with the attributes and operation signatures that you specifi ed in the model.
The words “ attribute ” and “ operation ” are UML terminology. In the .NET world, these are often referred to as “ fi eld ” and “ method, ” respectively.
As stated in Microsoft ’ s modeling strategy, this leads to a problem:
“ If the models they supported were used to generate code, they typically got out of sync once the developers added other code around the generated code. Even products that did a good job of ‘ round tripping ’ the generated code eventually overwhelmed developers with the complexity of solving this problem. Often, these problems were exacerbated, because CASE tools tried to operate at too high a level of abstraction relative to the implementation platform beneath. This forced them to generate large amounts of code, making it even harder to solve the problems caused by mixing handwritten and generated code. ”
The methods that are generated for each class by UML code - generation tools typically have complete signatures but empty bodies. This seems reasonable enough, because, after all, the tool is not psychic. How would it know how you intend to implement those methods? Well, actually, it could know.