Advanced Code Analysis in .NET




                                                                                                                                                          Stephen Ritchie
                                                                                                                                                                Nov 14, 2012



Stephen D. Ritchie – Senior Consultant – Excella Consulting, Inc., 2300 Wilson Blvd, Suite 630, Arlington, VA 22201 – 703.840.8600 – http://excella.com
Live Tweet, Slides and Examples

• Twitter: @RuthlessHelp
           @Apress

• Slides:
  http://www.slideshare.net/ruthlesshelp

• Code Samples:
  http://github.com/ruthlesshelp
Stephen D. Ritchie   2
Blueprint




Stephen D. Ritchie   3
Toolbox




Stephen D. Ritchie   4
Da Vinci Code … Analyzer




Stephen D. Ritchie   5
Code Analysis


Static
                     versus




Stephen D. Ritchie            6
Static Analysis




Stephen D. Ritchie   7
But wait …




Stephen D. Ritchie   8
1940 Tacoma Narrows Bridge

• Video
       – http://archive.org/download/SF121/SF121_51
         2kb.mp4




Stephen D. Ritchie         10
Static Analysis


Source   Visualizations
Code            Checks
Assembly       Metrics
            Detections
Stephen D. Ritchie   11
Dynamic Analysis


                     Visualizations
                            Checks
                           Metrics
                        Detections
Stephen D. Ritchie   12
Blueprint

                                     1

                               Analyze



                                                   2

                     Monitor             Improve
                     3




Stephen D. Ritchie              13
Toolbox


                      FxCop
Detections
Checks
                      Visual
                      Studio
       http://blogs.msdn.com/b/codeanalysis/
Stephen D. Ritchie           14
Toolbox


                      StyleCop
Detections
Checks


       http://stylecop.codeplex.com/
Stephen D. Ritchie            15
Toolbox


                        ReSharper
                        http://www.jetbrains.com/resharper/
Detections
Checks
                        Gendarme
                     http://www.mono-project.com/Gendarme

Stephen D. Ritchie                16
The Master Craft




Stephen D. Ritchie   17
Toolbox


                                 Simian
Detections

       http://www.harukizaemon.com/simian/



Stephen D. Ritchie          18
The Master Craft

                        Duplicates Finder .NET


       http://www.jetbrains.com/teamcity/

                     Clone Doctor
                     Semantic Designs
       http://www.semdesigns.com/Products/Clone/
Stephen D. Ritchie            19
Dynamic Analysis




                     Code Coverage
Stephen D. Ritchie      20
Toolbox


                     dotCover


       http://www.jetbrains.com/dotcover/



Stephen D. Ritchie           21
Toolbox


                     Open Cover


       http://nuget.org/packages/OpenCover



Stephen D. Ritchie          22
The Master Craft




       http://www.ncover.com/



Stephen D. Ritchie          23
Dynamic Analysis




                            Sampling
                     Instrumentation
Stephen D. Ritchie        24
Toolbox


                     Performance




Stephen D. Ritchie      25
Toolbox


                     Performance


                     http://www.jetbrains.com/profiler/

Stephen D. Ritchie           26
The Master Craft




Stephen D. Ritchie   27
The Master Craft


                     Memory
                     Queries
                     Logging
                     Security
Stephen D. Ritchie       28
Static Analysis


Source   Visualizations
Code            Checks
Assembly       Metrics
            Detections
Stephen D. Ritchie   29
The Master Craft


                     Code Quality
Visualizations         http://www.ndepend.com/
Checks
Metrics
Detections             http://www.lattix.com/

Stephen D. Ritchie      30
Hanselman’s Placemat




       http://bit.ly/LwKfwK
Stephen D. Ritchie            31
Shameless Self Promotion Time!

                     • 40% off eBook at
                       apress.com

                     • Use promo code:
                       PR0N3T

                     • Offer expires 15-Dec-
                       2012
Stephen D. Ritchie       32
Stephen’s Contact Info

• Twitter: @ruthlesshelp

• Email: stephen.ritchie@excella.com

• Blog:              http://ruthlesslyhelpful.net

• LinkedIn:
     http://www.linkedin.com/in/sritchie

Stephen D. Ritchie              33

Advanced Code Analysis with .NET

  • 1.
    Advanced Code Analysisin .NET Stephen Ritchie Nov 14, 2012 Stephen D. Ritchie – Senior Consultant – Excella Consulting, Inc., 2300 Wilson Blvd, Suite 630, Arlington, VA 22201 – 703.840.8600 – http://excella.com
  • 2.
    Live Tweet, Slidesand Examples • Twitter: @RuthlessHelp @Apress • Slides: http://www.slideshare.net/ruthlesshelp • Code Samples: http://github.com/ruthlesshelp Stephen D. Ritchie 2
  • 3.
  • 4.
  • 5.
    Da Vinci Code… Analyzer Stephen D. Ritchie 5
  • 6.
    Code Analysis Static versus Stephen D. Ritchie 6
  • 7.
  • 8.
  • 9.
    1940 Tacoma NarrowsBridge • Video – http://archive.org/download/SF121/SF121_51 2kb.mp4 Stephen D. Ritchie 10
  • 10.
    Static Analysis Source Visualizations Code Checks Assembly Metrics Detections Stephen D. Ritchie 11
  • 11.
    Dynamic Analysis Visualizations Checks Metrics Detections Stephen D. Ritchie 12
  • 12.
    Blueprint 1 Analyze 2 Monitor Improve 3 Stephen D. Ritchie 13
  • 13.
    Toolbox FxCop Detections Checks Visual Studio http://blogs.msdn.com/b/codeanalysis/ Stephen D. Ritchie 14
  • 14.
    Toolbox StyleCop Detections Checks http://stylecop.codeplex.com/ Stephen D. Ritchie 15
  • 15.
    Toolbox ReSharper http://www.jetbrains.com/resharper/ Detections Checks Gendarme http://www.mono-project.com/Gendarme Stephen D. Ritchie 16
  • 16.
  • 17.
    Toolbox Simian Detections http://www.harukizaemon.com/simian/ Stephen D. Ritchie 18
  • 18.
    The Master Craft Duplicates Finder .NET http://www.jetbrains.com/teamcity/ Clone Doctor Semantic Designs http://www.semdesigns.com/Products/Clone/ Stephen D. Ritchie 19
  • 19.
    Dynamic Analysis Code Coverage Stephen D. Ritchie 20
  • 20.
    Toolbox dotCover http://www.jetbrains.com/dotcover/ Stephen D. Ritchie 21
  • 21.
    Toolbox Open Cover http://nuget.org/packages/OpenCover Stephen D. Ritchie 22
  • 22.
    The Master Craft http://www.ncover.com/ Stephen D. Ritchie 23
  • 23.
    Dynamic Analysis Sampling Instrumentation Stephen D. Ritchie 24
  • 24.
    Toolbox Performance Stephen D. Ritchie 25
  • 25.
    Toolbox Performance http://www.jetbrains.com/profiler/ Stephen D. Ritchie 26
  • 26.
  • 27.
    The Master Craft Memory Queries Logging Security Stephen D. Ritchie 28
  • 28.
    Static Analysis Source Visualizations Code Checks Assembly Metrics Detections Stephen D. Ritchie 29
  • 29.
    The Master Craft Code Quality Visualizations http://www.ndepend.com/ Checks Metrics Detections http://www.lattix.com/ Stephen D. Ritchie 30
  • 30.
    Hanselman’s Placemat http://bit.ly/LwKfwK Stephen D. Ritchie 31
  • 31.
    Shameless Self PromotionTime! • 40% off eBook at apress.com • Use promo code: PR0N3T • Offer expires 15-Dec- 2012 Stephen D. Ritchie 32
  • 32.
    Stephen’s Contact Info •Twitter: @ruthlesshelp • Email: stephen.ritchie@excella.com • Blog: http://ruthlesslyhelpful.net • LinkedIn: http://www.linkedin.com/in/sritchie Stephen D. Ritchie 33