Resharper
-
Upload
hanoh-aloni -
Category
Engineering
-
view
690 -
download
4
Transcript of Resharper
![Page 1: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/1.jpg)
Resharper
Refactoring and productivity extension by JetBrains
![Page 2: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/2.jpg)
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
![Page 3: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/3.jpg)
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
![Page 4: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/4.jpg)
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.
![Page 5: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/5.jpg)
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
![Page 6: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/6.jpg)
Features
• Code browsing• Code clean-up• Refactoring• Coding assistance• Micro code generation• Other useful features
![Page 7: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/7.jpg)
Support
• C# 5.0• VB11• JavaScript• CSS• HTML• ASP.NET • ASP.NET MVC
• Razor• XML, XAML• WinRT• MSBuild and NAnt
build scripts.
![Page 8: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/8.jpg)
![Page 9: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/9.jpg)
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
![Page 10: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/10.jpg)
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
![Page 11: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/11.jpg)
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
![Page 12: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/12.jpg)
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
![Page 13: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/13.jpg)
Part 4 : Coding assistance
• Code generation• Code templates• Code cleanup
![Page 14: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/14.jpg)
Part 5 : Micro code generation
• Snippets• Generators• Templates
![Page 15: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/15.jpg)
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
![Page 16: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/16.jpg)
Pros and cons
• Helps enforce standards• Boosts productivity• Helps code reviews• Good analysis tools
• Over-refactoring• Tool reliance• Shapes the way you
think
![Page 17: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/17.jpg)
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
![Page 18: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/18.jpg)
The end
![Page 19: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/19.jpg)
Extra
![Page 20: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/20.jpg)
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
![Page 21: Resharper](https://reader035.fdocuments.us/reader035/viewer/2022062316/58e519951a28ab624e8b4d8f/html5/thumbnails/21.jpg)
Sources
• http://www.jetbrains.com/resharper/webhelp/Code_Analysis__Examples_of_Quick-Fixes.html
• Wikipedia