Introduction. xxi
Who Is This Book For? xxi
Organization of This Book xxi
System Requirements xxii
The Companion Web Site xxii
Find Additional Content Online xxiii
Support for This Book xxiii
1 Code Quality in an Agile World 1
Traditional Methods of Software Development 2
Agile Methods of Software Development 3
Scrum 4
eXtreme Programming 5
Test-Driven Development 6
Moving Quality Upstream 8
Inside Microsoft: Windows Live Hotmail Engineering 10
Engineering Principles 10
Key Success Factors 11
Tactics for Writing Solid Code 13
Focus on Design 14
Defend and Debug 15
Analyze and Test 16
Improve Processes and Attitudes 16
Summary 17
Key Points 18
2 Class Design and Prototyping 19
Collaboration in Visual Studio 20
Think First, Code Later 21
Software Modeling 23
Unified Modeling Language 24
Prototyping 37
Summary 47
Key Points 47
3 Metaprogramming 49
What Is Metadata? 49
Metadata in Managed Applications 51
Application Configuration Files 52
Metadata in Your Applications 65
Inside Microsoft: Configuration Management in Windows Live Spaces 66
Summary 69
Key Points 69
4 Performance Is a Feature 71
Common Performance Challenges 72
Network Latency 72
Payload Size and Network Round Trips 74
Limited TCP Connections 75
Poorly Optimized Code 76
Analyzing Application Performance 78
Analyzing the Performance of Live Search 79
Tactics for Improving Web Application Performance 81
Reduce Payload Size 82
Cache Effectively 83
Optimize Network Traffic 84
Organize and Write Code for Better Performance 89
Incorporating Performance Best Practices 90
Establish a Performance Excellence Program 90
Inside Microsoft: Tackling Live Search Performance 92
Web Performance Principles 92
Key Success Factors 93
Summary 94
Key Points 95
5 Designing for Scale 97
Understanding Application Scalability 98
Approaches to Scalability 99
Database Scalability 102
Tactics for Scaling Web Applications 104
Inside Microsoft: Managing the Windows Live Messenger Service
Infrastructure 115
Engineering Principles 115
Summary 118
Key Points 118
6 Security Design and Implementation 121
Common Application Security Threats 121
Principles for Designing Secure Applications 123
Security Design Principles 124
SD3+C Strategy and Practices for Secure Applications 125
Secure by Design 126
Secure by Default 130
Secure in Deployment and Communication 131
Understanding NET Framework Security Principles 133
Additional Security Best Practices 139
Summary 141
Key Points 141
7 Managed Memory Model 143
Managed Heap 144
Garbage Collection 145
Managed Wrappers for Native Objects 146
GC Class 147
Large Object Heap 148
Finalization 151
Non-Deterministic Garbage Collection ..151
Disposable Objects 154
Dispose Pattern 155
Weak References 158
Pinning 160
Tips for the Managed Heap 162
CLR Profiler 163
CLR Profiler Walkthrough 164
Summary 168
Key Points 169
8 Defensive Programming 171
Defensive Programming and C# 172
Warnings 173
Code Review 174
Software Testing 175
Test-Driven Development 177
Code Coverage 180
Self-Documenting Code 181
Naming Conventions 182
Pseudo Code 183
Comments 185
Defensive Programming with Classes 188
Modifiers 189
Interfaces 189
Defensive Programming Without Examples 190
Defensive Programming with Examples 192
Design Patterns 196
Summary 198
Key Points 199
9 Debugging 201
Overflow Bug 205
Pentium FDIV Bug 205
Symbols 205
Symbol Server 208
Source Servers 209
Preemptive Debugging 210
Proactive Debugging 212
Managed Debugging Assistants 213
MDA Example 214
Code Analysis 215
Performance Monitoring 215
Debugging 218
Debugging Tools 220
Visual Studio 220
NET Framework Tools 222
Debugging Tools for Windows 223
CLR Profiler 224
Sysinternals 224
Tracing 225
Web Application Tracing 225
Exception Handling 227
Production Debugging 230
ADPlus 231
Summary 236
Key Points 237
10 Code Analysis
11 Improving Engineering Processes
12 Attitude Is Everything
A Aglie Development Resources
B Web Performance Resources
Index