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.

Resharper

1,008 views

Published on

Resharper introduction

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Resharper

  1. 1. Resharper Refactoring and productivity extension by JetBrains
  2. 2. Refactoring “A disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior" Abstraction Class fragmentation Naming convention
  3. 3. Refactoring - Abstraction • Techniques that allow for more abstraction – Encapsulate Field – force code to access the field with getter and setter methods – Generalize Type – create more general types to allow for more code sharing – Replace Type – Replace conditional with polymorphism
  4. 4. Refactoring - Class fragmentation • Techniques for breaking code apart into more logical pieces – Componentization breaks code down into reusable semantic units which present clear, well-defined, simple-to-use interfaces. – Extract Class moves part of the code from an existing class into a new class. – Extract Method, to turn part of a larger method into a new method. By breaking down code in smaller pieces, it is more easily understandable. This is also applicable to functions.
  5. 5. Refactoring - Naming convention • Techniques for improving names and location of code – Move Method or Move Field – move to a more appropriate Class or source file – Rename Method or Rename Field – changing the name into a new one that better reveals its purpose – Pull Up – in OOP, move to a superclass – Push Down – in OOP, move to a subclass
  6. 6. Features • Code browsing • Code clean-up • Refactoring • Coding assistance • Micro code generation • Other useful features
  7. 7. Support • C# 5.0 • VB11 • JavaScript • CSS • HTML • ASP.NET • ASP.NET MVC • Razor • XML, XAML • WinRT • MSBuild and NAnt build scripts.
  8. 8. IDEA vs VS • 2 different keyboard scheme – IDEA more familiar to Intellij IDE – VS scheme more familiar to VS users – VS scheme will never override a key mapped by visual studio
  9. 9. Part 1 : Code browsing • Navigate : ART-R-N Find : ALT-R-F • Navigate to : Alt-' File : ctrl-t / ctrl-shft-t / alt- shift-t • Related files : ctrl - alt - f7 • Goto implementation : ctrl-F12 • Goto definition : alt-F12 • Find usages : shift f12
  10. 10. Part 2 : Code clean-up • quickfix trio : – Alt-Enter – Alt-PgDn – Alt-PgUp • moving code around: ctrl-alt-shift-arrows • View file structure: ctrl-alt-f • Code cleanup: ctrl-e-c • see: resharper -> options -> c# -> formatting style • Safe delete : alt-Del
  11. 11. Part 3 : Refactoring • Convert • Rename • Change signature • Encapsulate/extract fields/properties/classes • Introduce field/method/variable • Inline field/method/variable • Move to folder • Pull and push memebers
  12. 12. Part 4 : Coding assistance • Code generation • Code templates • Code cleanup
  13. 13. Part 5 : Micro code generation • Snippets • Generators • Templates
  14. 14. Part 6 - other • Stack trace explorer • goto decleration to decompiled MSIL • TODO list explorer • Test runner • Globalization • Patterns catalog • XML document support • MSBuild or nant build scripts support • Javascript and CSS support
  15. 15. Pros and cons • Helps enforce standards • Boosts productivity • Helps code reviews • Good analysis tools • Over-refactoring • Tool reliance • Shapes the way you think
  16. 16. Learning tips • Keep the keymap under your keyboard • Focus on a few commands at a time • Don’t be afraid to try new shortcuts • Keep your hands on the keyboard • Watch other people use Resharper • Learn with friends and teammates
  17. 17. The end
  18. 18. Extra
  19. 19. What does it do? • solution-wide static code analysis (error detection on-the-fly, without the need to compile) • provides additional features for error correction • code completion, navigation, search • syntax highlighting, formatting • code generation and optimization • carries out 40 automated refactorings and streamlines unit testing using NUnit and MSTest
  20. 20. Sources • http://www.jetbrains.com/resharper/webhelp /Code_Analysis__Examples_of_Quick- Fixes.html • Wikipedia

×