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.

Creating High Quality Visual Studio extensions

4,709 views

Published on

As seen on the 2-part Channel9 videos on the Visual Studio Toolbox show with Robert Green.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Creating High Quality Visual Studio extensions

  1. 1. Writing High Quality Visual Studio Extensions Omer Raviv | omerr@codevalue.net | @omerraviv www.oz-code.com | @oz_code Testable, stable, performant, memory efficient
  2. 2. 2 @omerraviv on Twitter (twitter picture) @omerraviv on Gitter.im/extendvs (Gitter logo) Omer Raviv • Creator and CTO of OzCode • Senior Consultant @ CodeValue • .NET open-source enthusiast • Passionate about dev productivity @omerraviv on Twitter @omerraviv on Gitter (gitter.im/extendvs)
  3. 3. My Journey as a developer
  4. 4. Every minute spent in the debugger is a minute squandered
  5. 5. The two most common ways to use a debugger: 1. Wasting time 2. Quality time
  6. 6. Wasting time: Not knowing what your hypothesis is at any given time Getting into a rot mindlessly hitting F10 Quality time: Apply the Scientific Method, religiously Simplify the scenario, then write a test! The Debugging Process Overview !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  7. 7. Why can’t Johnny do Test Driven Development?
  8. 8. A typical unit test Test Driven Woes
  9. 9. 2 Unit Tests. 0 Integration Tests.
  10. 10. UI System/ Subcutaneous Unit Automation Harder Easier Exploration Mike Cohn’s Test Automation Pyramid Writing test at the right level of granularity
  11. 11. UI System/ Subcutaneous Unit Exploration Writing test at the right level of granularity Microsoft/VisualStudio-TestHost/TestUtilities , PTVS JaredPar/VsVim/Test OzCode/VSIntegrationTestSamples
  12. 12. • Synthesis and refinement of practices stemming from TDD & ATDD • User story: "As a [role] I want [feature] so that [benefit]” • Acceptance Criteria Given [initial context] When [event occurs] Then [ensure some outcome] What’s this BDD thing?
  13. 13. Create living, executable Specification. New feature? Can I see the requirements doc please? What’s BDD all about?
  14. 14. • Use natural language to express intentions (Given…When…Then) • Use a general purpose programming language to express test mechanics • Use a tool that will let you operate in either domain seamlessly BDD offers a solution
  15. 15. Michael WhelanMehdi Khalili Jake Ginnivan Jason Roberts PM> Install-Package TestStack.BDDfy
  16. 16. • Works with any testing framework • Does not require its own test runner • Creates Humanized, story-like error messages A few quick BDDfy facts:
  17. 17. Demo time!
  18. 18. My very first Visual Studio Subcutaneous Test
  19. 19. Having flakey tests is a lot worse than having no tests at all. A flakey test is like a virus – quarantine it, then triage. Visual Studio Integration Tests Pro-Tip
  20. 20. Writing High Quality Visual Studio extensions Omer Raviv | omerr@codevalue.net | @omerraviv www.oz-code.com | @oz_code Testable, stable, performant, memory efficient
  21. 21. The ActivityLog.xml MessageBox …of pain and suffering
  22. 22. The ActivityLog.xml MessageBox …of pain and suffering github.com/oz-code/OzCode.VisualStudioExtensionAnalyzers PM> Install-Package OzCode.VisualStudioExtensionAnalyzers
  23. 23. Use an Exception Monitoring Tool Use an Exception Monitoring Tool
  24. 24. Use an Exception Monitoring Tool
  25. 25. Dealing with crashes Starting with VS2017.3, users get a notification if an exception might be involved in a crash.
  26. 26. https://gist.github.com/oz-code/76446034c493685bfaabdd5aecc43180 Dealing with crashes
  27. 27. Writing High Quality Visual Studio extensions Omer Raviv | omerr@codevalue.net | @omerraviv www.oz-code.com | @oz_code Testable, stable, performant, memory efficient
  28. 28. Visual Studio 2017 will warn users about extensions that are slowing things down. Performance as a Feature
  29. 29. 1. Delay loading your extension as much as possible (using UIContextRule) 2. When you do load, load in the background. (using AsyncPackage) Performance as a Feature
  30. 30. OzCode F10 Monkey http://www.github.com/oz-code/VSExplorationTests
  31. 31. Writing High Quality Visual Studio extensions Omer Raviv | omerr@codevalue.net | @omerraviv www.oz-code.com | @oz_code Testable, stable, performant, memory efficient
  32. 32. Memory Leaks vs. GC Pressure GC Pressure: Memory Leak:
  33. 33. Memory Leaks vs. GC Pressure Pro-Tip: Don’t Close your Diagnostics Tools Window!
  34. 34. Dealing with GC Pressure Memory Leaks vs. GC Pressure • Always be measuring (allocations, % time spent in GC) • Watch out for duplicate strings • Use object pooling / a string intern pool • Use Roslyn Heap Allocation Analyzer
  35. 35. github.com/jaredpar/vsvim Memory Leak Testing Subcutaneous Tests Pro-Tip
  36. 36. Memory Leak Testing Subcutaneous Tests Pro-Tip
  37. 37. Which means… …a business sponsor could request that the current development version of the software can be deployed into production at a moment's notice - and nobody would bat an eyelid, let alone panic. Got good Subcutaneous Tests? Start practicing True Continuous Delivery! Martin Fowler
  38. 38. Thank You! @oz_code http://oz-code.com

×