Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
An Overview of.NET Best Practices      Stephen D. Ritchie      15 Nov 2012
Live Tweet, Tonight’s Slides and Examples• Twitter:      @RuthlessHelp                @Apress• Slideshare: http://www.slid...
Overall – Challenges Continuous Integration            No CI Server            No Code Analysis            Not Triggered b...
Overall – Challenges Code Reviews            Not Conducted            Issues Not Tracked            Issues Dropped        ...
Current – Challenges Automated Builds and Deployments            Manual Deployment            No Automated Testing        ...
Current – Challenges Automated Unit Testing            Low Code Coverage            No Mocking Framework            Failin...
Opportunities Best Practices Matrix     Complexity                      Value     Risk     Cost                Excella Con...
Minimal, Essential Source Control                     Excella Consulting   -8-
TFSExcella Consulting         -9-
SVNExcella Consulting         - 10 -
MercurialExcella Consulting   - 11 -
GitExcella Consulting         - 12 -
Level Metaphor                 Excella Consulting   - 13 -
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 1 – Goals Build Script                  Excella Consulting   - 15 -
Level 1 – Starting Point Manual Builds                           Excella Consulting   - 16 -
MSBuildExcella Consulting   - 17 -
NAntExcella Consulting          - 18 -
PowerShellExcella Consulting   - 19 -
ExtensionsExcella Consulting   - 20 -
Level 1 – Example Example Build Script                    Excella Consulting   - 21 -
Level 1 – ResultBuild ScriptOne Script,Builds Everything“Run the Runner”                   Excella Consulting   - 22 -
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 2 – Goals Continuous Integration                  Excella Consulting   - 24 -
Level 2 – Starting Point No CI Server                           Excella Consulting   - 25 -
Level 2 – To Do Install CI Server       Triggered by Code Push       “Run the Runner”                  Excella Consulting ...
TFSExcella Consulting         - 27 -
CC.NETExcella Consulting   - 28 -
JenkinsExcella Consulting     - 29 -
TeamCityExcella Consulting   - 30 -
Level 2 – Example CI Server Example                    Excella Consulting   - 31 -
Level 2 – Result Observe & Report                   Excella Consulting   - 32 -
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 3 – Goals Code Analysis                  Excella Consulting   - 34 -
Level 3 – Starting Point No Code Analysis                           Excella Consulting   - 35 -
Level 3 – To Do Analysis Tool       Static Code Analysis       Run with CI Server                  Excella Consulting   - ...
FxCopExcella Consulting           - 37 -
GendarmeExcella Consulting   - 38 -
StyleCopExcella Consulting   - 39 -
NDependExcella Consulting   - 40 -
SimianExcella Consulting       - 41 -
SonarExcella Consulting           - 42 -
Level 3 – Example Analysis Tool Example                       FxCop 10                    Excella Consulting   - 43 -
Level 3 – Result Analyze, Improve, Monitor                   Excella Consulting   - 44 -
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 4 – Goals Automate Testing                  Excella Consulting   - 46 -
Level 4 – Starting Point No Tests                           Excella Consulting   - 47 -
Level 4 – To Do Testing Framework       Run with Runner       Run with CI Server                  Excella Consulting   - 4...
MSTestExcella Consulting    - 49 -
MBUnitExcella Consulting     - 50 -
xUnit.netExcella Consulting   - 51 -
NUnitExcella Consulting           - 52 -
Level 4 – To Do Mocking Framework       Isolation       Interaction Testing                   Excella Consulting   - 53 -
Rhino Mocks  Excella Consulting   - 54 -
MoqExcella Consulting         - 55 -
Level 4 – Example Automate Testing Example                    Excella Consulting   - 56 -
Level 4 – Results Passing Tests                    Excella Consulting   - 57 -
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 5 – Goals Code Coverage            + More Tests            + More Code Analysis                  Excella Consulting ...
Level 5 – To Do Coverage Tool       Run in Visual Studio       Run with CI Server                  Excella Consulting   - ...
NCoverExcella Consulting    - 61 -
OpenCoverExcella Consulting   - 62 -
dotCoverExcella Consulting   - 63 -
Level 5 – Example Code Coverage Example                    Excella Consulting   - 64 -
Level 5 – Results 100% Class Coverage            + More Code Analysis                    Excella Consulting   - 65 -
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 6 – Goals Code Review            + More Tests            + More Code Analysis                  Excella Consulting   ...
Level 6 – To Do Pick Approach       Share Opinions       Track Issues                  Excella Consulting   - 68 -
PairingExcella Consulting        - 69 -
GroupExcella Consulting           - 70 -
PeerExcella Consulting          - 71 -
Level 6 – Example Code Review Example                                         Peer                    Excella Consulting  ...
Level 6 – Results Reviewed Code            100% Method Coverage            + More Code Analysis                    Excella...
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 7 – Goals Packaging            + More Tests            + More Coverage            + More Code Analysis              ...
MSIExcella Consulting         - 76 -
Web Deploy Excella Consulting   - 77 -
OctopusExcella Consulting   - 78 -
Zip Archive Excella Consulting   - 79 -
Level 7 – Example Packaging Example                                         Zip                    Excella Consulting     ...
Level 7 – Results Packaged Deliverable            Code Reviews            40% Line Coverage            + More Code Analysi...
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 8 – Goals Automated Deployments            + More Tests            + More Line Coverage            + More Code Analy...
ScriptExcella Consulting            - 84 -
Level 8 – Example Automated Deployment Example                       MSBuild                    Excella Consulting   - 85 -
Level 8 – Results Automated Deployments            + Code Reviews            + 60% Line Coverage            + More Code An...
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Level 9 – Goals Full Code Coverage            + More Tests            + More Coverage            + More Code Analysis     ...
TestingExcella Consulting     - 89 -
Level 9 – Example Full Code Coverage Example                    Excella Consulting   - 90 -
Level 9 – Results > 80% Line Coverage            + Code Reviews            Automated Deployments            + More Code An...
Go to Green  1         2               3  4         5               6  7         8               9       Excella Consultin...
Overall – Results Continuous Integration            CI Server            Code Analysis            Triggered by SCM        ...
Overall – Results Code Reviews            Conducted Regularly            Issues Tracked            Issues Resolved        ...
Overall – Results Automated Builds and Deployments            Automated Deployment            Automated Testing           ...
Overall – Results Automated Unit Testing            Code Coverage: > 80%            Mocking Framework            Passing T...
Follow On – Goals RetrospectivesPresentations                    Excella Consulting   - 97 -
Further Discussion            Any questions?           Any comments?                     Excella Consulting
Shameless Self Promotion Time!                            40% off eBook at                            apress.com          ...
Contact Me• Twitter:    @ruthlesshelp• Email:      stephen.ritchie@excella.com• Blog:       http://ruthlesslyhelpful.net• ...
Slides and Examples• Slideshare: http://www.slideshare.net/ruthlesshelp• Github:      http://github.com/ruthlesshelp      ...
Upcoming SlideShare
Loading in …5
×

An Overview of .NET Best Practices

1,087 views

Published on

This presentation is a practical overview of many of the best practices that you can apply to your .NET projects today. We will cover a broad range of practices and principles with an emphasis on tools and technologies in four key areas: build automation, continuous integration, automated testing, and code analysis. Since complex problems often require iterative solutions, this presentation looks at an iterative approach to adopting new and better practices. Through a stepwise process we’ll examine key areas to improve, how to get started and continue to grow implementation, and what might motivate folks to stick with .NET best practices.

Published in: Technology
  • Be the first to comment

An Overview of .NET Best Practices

  1. 1. An Overview of.NET Best Practices Stephen D. Ritchie 15 Nov 2012
  2. 2. Live Tweet, Tonight’s Slides and Examples• Twitter: @RuthlessHelp @Apress• Slideshare: http://www.slideshare.net/ruthlesshelp• Github: http://github.com/ruthlesshelp Excella Consulting
  3. 3. Overall – Challenges Continuous Integration No CI Server No Code Analysis Not Triggered by SCM Excella Consulting -3-
  4. 4. Overall – Challenges Code Reviews Not Conducted Issues Not Tracked Issues Dropped Excella Consulting -4-
  5. 5. Current – Challenges Automated Builds and Deployments Manual Deployment No Automated Testing No Code Analysis Excella Consulting -5-
  6. 6. Current – Challenges Automated Unit Testing Low Code Coverage No Mocking Framework Failing or Ignored Tests Excella Consulting -6-
  7. 7. Opportunities Best Practices Matrix Complexity Value Risk Cost Excella Consulting -7-
  8. 8. Minimal, Essential Source Control Excella Consulting -8-
  9. 9. TFSExcella Consulting -9-
  10. 10. SVNExcella Consulting - 10 -
  11. 11. MercurialExcella Consulting - 11 -
  12. 12. GitExcella Consulting - 12 -
  13. 13. Level Metaphor Excella Consulting - 13 -
  14. 14. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 14 -
  15. 15. Level 1 – Goals Build Script Excella Consulting - 15 -
  16. 16. Level 1 – Starting Point Manual Builds Excella Consulting - 16 -
  17. 17. MSBuildExcella Consulting - 17 -
  18. 18. NAntExcella Consulting - 18 -
  19. 19. PowerShellExcella Consulting - 19 -
  20. 20. ExtensionsExcella Consulting - 20 -
  21. 21. Level 1 – Example Example Build Script Excella Consulting - 21 -
  22. 22. Level 1 – ResultBuild ScriptOne Script,Builds Everything“Run the Runner” Excella Consulting - 22 -
  23. 23. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 23 -
  24. 24. Level 2 – Goals Continuous Integration Excella Consulting - 24 -
  25. 25. Level 2 – Starting Point No CI Server Excella Consulting - 25 -
  26. 26. Level 2 – To Do Install CI Server Triggered by Code Push “Run the Runner” Excella Consulting - 26 -
  27. 27. TFSExcella Consulting - 27 -
  28. 28. CC.NETExcella Consulting - 28 -
  29. 29. JenkinsExcella Consulting - 29 -
  30. 30. TeamCityExcella Consulting - 30 -
  31. 31. Level 2 – Example CI Server Example Excella Consulting - 31 -
  32. 32. Level 2 – Result Observe & Report Excella Consulting - 32 -
  33. 33. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 33 -
  34. 34. Level 3 – Goals Code Analysis Excella Consulting - 34 -
  35. 35. Level 3 – Starting Point No Code Analysis Excella Consulting - 35 -
  36. 36. Level 3 – To Do Analysis Tool Static Code Analysis Run with CI Server Excella Consulting - 36 -
  37. 37. FxCopExcella Consulting - 37 -
  38. 38. GendarmeExcella Consulting - 38 -
  39. 39. StyleCopExcella Consulting - 39 -
  40. 40. NDependExcella Consulting - 40 -
  41. 41. SimianExcella Consulting - 41 -
  42. 42. SonarExcella Consulting - 42 -
  43. 43. Level 3 – Example Analysis Tool Example FxCop 10 Excella Consulting - 43 -
  44. 44. Level 3 – Result Analyze, Improve, Monitor Excella Consulting - 44 -
  45. 45. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 45 -
  46. 46. Level 4 – Goals Automate Testing Excella Consulting - 46 -
  47. 47. Level 4 – Starting Point No Tests Excella Consulting - 47 -
  48. 48. Level 4 – To Do Testing Framework Run with Runner Run with CI Server Excella Consulting - 48 -
  49. 49. MSTestExcella Consulting - 49 -
  50. 50. MBUnitExcella Consulting - 50 -
  51. 51. xUnit.netExcella Consulting - 51 -
  52. 52. NUnitExcella Consulting - 52 -
  53. 53. Level 4 – To Do Mocking Framework Isolation Interaction Testing Excella Consulting - 53 -
  54. 54. Rhino Mocks Excella Consulting - 54 -
  55. 55. MoqExcella Consulting - 55 -
  56. 56. Level 4 – Example Automate Testing Example Excella Consulting - 56 -
  57. 57. Level 4 – Results Passing Tests Excella Consulting - 57 -
  58. 58. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 58 -
  59. 59. Level 5 – Goals Code Coverage + More Tests + More Code Analysis Excella Consulting - 59 -
  60. 60. Level 5 – To Do Coverage Tool Run in Visual Studio Run with CI Server Excella Consulting - 60 -
  61. 61. NCoverExcella Consulting - 61 -
  62. 62. OpenCoverExcella Consulting - 62 -
  63. 63. dotCoverExcella Consulting - 63 -
  64. 64. Level 5 – Example Code Coverage Example Excella Consulting - 64 -
  65. 65. Level 5 – Results 100% Class Coverage + More Code Analysis Excella Consulting - 65 -
  66. 66. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 66 -
  67. 67. Level 6 – Goals Code Review + More Tests + More Code Analysis Excella Consulting - 67 -
  68. 68. Level 6 – To Do Pick Approach Share Opinions Track Issues Excella Consulting - 68 -
  69. 69. PairingExcella Consulting - 69 -
  70. 70. GroupExcella Consulting - 70 -
  71. 71. PeerExcella Consulting - 71 -
  72. 72. Level 6 – Example Code Review Example Peer Excella Consulting - 72 -
  73. 73. Level 6 – Results Reviewed Code 100% Method Coverage + More Code Analysis Excella Consulting - 73 -
  74. 74. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 74 -
  75. 75. Level 7 – Goals Packaging + More Tests + More Coverage + More Code Analysis Excella Consulting - 75 -
  76. 76. MSIExcella Consulting - 76 -
  77. 77. Web Deploy Excella Consulting - 77 -
  78. 78. OctopusExcella Consulting - 78 -
  79. 79. Zip Archive Excella Consulting - 79 -
  80. 80. Level 7 – Example Packaging Example Zip Excella Consulting - 80 -
  81. 81. Level 7 – Results Packaged Deliverable Code Reviews 40% Line Coverage + More Code Analysis Excella Consulting - 81 -
  82. 82. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 82 -
  83. 83. Level 8 – Goals Automated Deployments + More Tests + More Line Coverage + More Code Analysis Excella Consulting - 83 -
  84. 84. ScriptExcella Consulting - 84 -
  85. 85. Level 8 – Example Automated Deployment Example MSBuild Excella Consulting - 85 -
  86. 86. Level 8 – Results Automated Deployments + Code Reviews + 60% Line Coverage + More Code Analysis Excella Consulting - 86 -
  87. 87. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 87 -
  88. 88. Level 9 – Goals Full Code Coverage + More Tests + More Coverage + More Code Analysis Excella Consulting - 88 -
  89. 89. TestingExcella Consulting - 89 -
  90. 90. Level 9 – Example Full Code Coverage Example Excella Consulting - 90 -
  91. 91. Level 9 – Results > 80% Line Coverage + Code Reviews Automated Deployments + More Code Analysis Excella Consulting - 91 -
  92. 92. Go to Green 1 2 3 4 5 6 7 8 9 Excella Consulting - 92 -
  93. 93. Overall – Results Continuous Integration CI Server Code Analysis Triggered by SCM Excella Consulting - 93 -
  94. 94. Overall – Results Code Reviews Conducted Regularly Issues Tracked Issues Resolved Excella Consulting - 94 -
  95. 95. Overall – Results Automated Builds and Deployments Automated Deployment Automated Testing Code Analysis Excella Consulting - 95 -
  96. 96. Overall – Results Automated Unit Testing Code Coverage: > 80% Mocking Framework Passing Tests: Priority Excella Consulting - 96 -
  97. 97. Follow On – Goals RetrospectivesPresentations Excella Consulting - 97 -
  98. 98. Further Discussion Any questions? Any comments? Excella Consulting
  99. 99. Shameless Self Promotion Time! 40% off eBook at apress.com Use promo code: PR0N3T Offer ends 15-Dec-2012 Excella Consulting
  100. 100. Contact Me• Twitter: @ruthlesshelp• Email: stephen.ritchie@excella.com• Blog: http://ruthlesslyhelpful.net• LinkedIn: http://www.linkedin.com/in/sritchie Excella Consulting
  101. 101. Slides and Examples• Slideshare: http://www.slideshare.net/ruthlesshelp• Github: http://github.com/ruthlesshelp Excella Consulting

×