Upload
stephen-ritchie
View
69
Download
7
Tags:
Embed Size (px)
Citation preview
An Overview of
.NET Best Practices
Stephen D. Ritchie
Rappahannock Area Developers .NET Users Group
17 Mar 2015
Excella Consulting
Overall – Challenges
Continuous Integration
No CI Server
No Code Analysis
Not Triggered by SCM
- 2 -
Excella Consulting
Overall – Challenges
Code Reviews
Not Conducted
Issues Not Tracked
Issues Dropped
- 3 -
Excella Consulting
Current – Challenges
Automated Builds and
Deployments
Manual Deployment
No Automated Testing
No Code Analysis
- 4 -
Excella Consulting
Current – Challenges
Automated Unit Testing
Low Code Coverage
No Mocking Framework
Failing or Ignored Tests
- 5 -
Excella Consulting
Opportunities
- 6 -
Best Practices Matrix
Complexity
Risk
Cost
Value
Excella Consulting
Minimal, Essential
Source Control
- 7 -
Excella Consulting
TFS
- 8 -
Excella Consulting
SVN
- 9 -
Excella Consulting
Mercurial
- 10 -
Excella Consulting
Git
- 11 -
Excella Consulting
Level Metaphor
- 12 -
Excella Consulting
32
4 5 6
7 8 9
1
Go to Green
- 13 -
Excella Consulting
Level 1 – Goals
Build Script
- 14 -
Excella Consulting
Level 1 – Starting Point
Manual Builds
- 15 -
Excella Consulting
MSBuild
- 16 -
Excella Consulting
NAnt
- 17 -
Excella Consulting
PowerShell
- 18 -
Excella Consulting
Extensions
- 19 -
Excella Consulting
Level 1 – Example
- 20 -
Example Build
Script
Excella Consulting
Level 1 – Result
One Script,
Builds Everything
- 21 -
“Run the Runner”
Build Script
Excella Consulting
32
4 5 6
7 8 9
1
Go to Green
- 22 -
Excella Consulting
Level 2 – Goals
Continuous
Integration
- 23 -
Excella Consulting
Level 2 – Starting Point
No CI Server
- 24 -
Excella Consulting
Level 2 – To Do
Install CI Server
Triggered by Code Push
“Run the Runner”
- 25 -
Excella Consulting
TFS
- 26 -
Excella Consulting
CC.NET
- 27 -
Excella Consulting
Jenkins
- 28 -
Excella Consulting
TeamCity
- 29 -
Excella Consulting
Level 2 – Example
- 30 -
CI Server
Example
Excella Consulting
Level 2 – Result
Observe & Report
- 31 -
Excella Consulting
3
4 5 6
7 8 9
1 2
Go to Green
- 32 -
Excella Consulting
Level 3 – Goals
Code Analysis
- 33 -
Excella Consulting
Level 3 – Starting Point
No Code Analysis
- 34 -
Excella Consulting
Level 3 – To Do
Analysis Tool
Static Code Analysis
Run with CI Server
- 35 -
Excella Consulting
FxCop
- 36 -
Excella Consulting
Gendarme
- 37 -
Excella Consulting
StyleCop
- 38 -
Excella Consulting
NDepend
- 39 -
Excella Consulting
Simian
- 40 -
Excella Consulting
Sonar
- 41 -
Excella Consulting
Level 3 – Example
FxCop 10
- 42 -
Analysis Tool
Example
Excella Consulting
Level 3 – Result
Analyze,
Improve,
Monitor
- 43 -
Excella Consulting
4 5 6
7 8 9
1 2 3
Go to Green
- 44 -
Excella Consulting
Level 4 – Goals
Automate Testing
- 45 -
Excella Consulting
Level 4 – Starting Point
No Tests
- 46 -
Excella Consulting
Level 4 – To Do
Testing Framework
Run with Runner
Run with CI Server
- 47 -
Excella Consulting
MSTest
- 48 -
Excella Consulting
MBUnit
- 49 -
Excella Consulting
xUnit.net
- 50 -
Excella Consulting
NUnit
- 51 -
Excella Consulting
Level 4 – To Do
Mocking Framework
Isolation
Interaction Testing
- 52 -
Excella Consulting
Rhino Mocks
- 53 -
Excella Consulting
Moq
- 54 -
Excella Consulting
Level 4 – Example
- 55 -
Automate Testing
Example
Excella Consulting
Level 4 – Results
Passing
Tests
- 56 -
Excella Consulting
5 6
7 8 9
1 2 3
4
Go to Green
- 57 -
Excella Consulting
Level 5 – Goals
Code Coverage
+ More Tests
+ More Code Analysis
- 58 -
Excella Consulting
Level 5 – To Do
Coverage Tool
Run in Visual Studio
Run with CI Server
- 59 -
Excella Consulting
NCover
- 60 -
Excella Consulting
OpenCover
- 61 -
Excella Consulting
dotCover
- 62 -
Excella Consulting
Level 5 – Example
- 63 -
Code Coverage
Example
Excella Consulting
Level 5 – Results
100% Class Coverage
+ More Code Analysis
- 64 -
Excella Consulting
6
7 8 9
1 2 3
4 5
Go to Green
- 65 -
Excella Consulting
Level 6 – Goals
Code Review
+ More Tests
+ More Code Analysis
- 66 -
Excella Consulting
Level 6 – To Do
Pick Approach
Share Opinions
Track Issues
- 67 -
Excella Consulting
Pairing
- 68 -
Excella Consulting
Group
- 69 -
Excella Consulting
Peer
- 70 -
Excella Consulting
Level 6 – Example
Peer
- 71 -
Code Review
Example
Excella Consulting
Level 6 – Results
Reviewed Code
100% Method Coverage
+ More Code Analysis
- 72 -
Excella Consulting
7 8 9
1 2 3
4 5 6
Go to Green
- 73 -
Excella Consulting
Level 7 – Goals
Packaging
+ More Coverage
+ More Code Analysis
+ More Tests
- 74 -
Excella Consulting
MSI
- 75 -
Excella Consulting
Web Deploy
- 76 -
Excella Consulting
Octopus
- 77 -
Excella Consulting
Zip Archive
- 78 -
Excella Consulting
Level 7 – Example
Zip
- 79 -
Packaging Example
Excella Consulting
Level 7 – Results
Packaged Deliverable
Code Reviews
40% Line Coverage
+ More Code Analysis
- 80 -
Excella Consulting
8 9
1 2 3
4 5 6
7
Go to Green
- 81 -
Excella Consulting
Level 8 – Goals
Automated
Deployments
+ More Tests
+ More Line Coverage
+ More Code Analysis
- 82 -
Excella Consulting
Script
- 83 -
Excella Consulting
Level 8 – Example
MSBuild
- 84 -
Automated
Deployment Example
Excella Consulting
Level 8 – Results
Automated
Deployments
+ Code Reviews
+ 60% Line Coverage
+ More Code Analysis
- 85 -
Excella Consulting
9
1 2 3
4 5 6
7 8
Go to Green
- 86 -
Excella Consulting
Level 9 – Goals
Full Code Coverage
+ More Tests
+ More Coverage
+ More Code Analysis
- 87 -
Excella Consulting
Testing
- 88 -
Excella Consulting
Level 9 – Example
- 89 -
Full Code Coverage
Example
Excella Consulting
Level 9 – Results
> 80% Line Coverage
+ Code Reviews
Automated Deployments
+ More Code Analysis
- 90 -
Excella Consulting
1 2 3
4 5 6
7 8 9
Go to Green
- 91 -
Excella Consulting
Overall – Results
Continuous Integration
CI Server
Code Analysis
Triggered by SCM
- 92 -
Excella Consulting
Overall – Results
Code Reviews
Conducted Regularly
Issues Tracked
Issues Resolved
- 93 -
Excella Consulting
Overall – Results
Automated Builds and
Deployments
Automated Deployment
Automated Testing
Code Analysis
- 94 -
Excella Consulting
Overall – Results
Automated Unit Testing
Code Coverage: > 80%
Mocking Framework
Passing Tests: Priority
- 95 -
Excella Consulting
Follow On – Goals
Retrospectives
Presentations
- 96 -