29
Productivity with Visual Studio ~Ahasan Habib

Productivity Enhencement with Visual Studio

Embed Size (px)

Citation preview

Page 1: Productivity Enhencement with Visual Studio

Productivity with

Visual Studio~Ahasan Habib

Page 2: Productivity Enhencement with Visual Studio

1. Introduction to Visual Studio2. Keyboard Stock VS Mouse click3. Web Analyzer (JSLint, CssCop, StyleCop)4. Regular Expression Tester5. Code Snippet 6. Web Essentials7. Productivity Power tools8. Smart Debugging9. Top 11 Visual Studio Cool Features10.Resharper11.Conclusion

Outline

Page 3: Productivity Enhencement with Visual Studio

Introduction to Visual Studio1. Official Site https://www.visualstudio.com/ || https://www.g2crowd.com||

2. IDE (code accuracy, code generation, file structure, , intelligence, code checking, debugging and many more…)

3. IDE Vs Code Editor

4. Visual Studio Version (Community, [Community, Professional, Enterprise, Code]

5. [ VS 2010, VS 2012, VS 2013, VS 2015 ]6. Service Pack

7. Extensions

8. Themes

Page 4: Productivity Enhencement with Visual Studio

Visual Studio Version Help > About Microsoft Visual Studio

Page 5: Productivity Enhencement with Visual Studio

ExtensionsTools > Extensions and Update...

Page 6: Productivity Enhencement with Visual Studio

Themes: Black(Dark) VS Light (White) Tools > Options > General > Color theme:

Page 7: Productivity Enhencement with Visual Studio

Hot Key Vs Menu Click● Undo-Redo (ctrl+z, ctrl+y)● Find (ctrl + f)● Go to Line (ctrl + g)● Navigate front/back (ctrl + -, ctrl + shift + - )● Code Selection (ctrl + a, shift+arrow)● Code Commenting/un-comenting (ctrl + k +c, ctrl + k + u)● Code formatting (select code block => ctrl + k + f ● more...

Page 8: Productivity Enhencement with Visual Studio

Web Analyzer● JSLint

● CssCop

● StyleCop

Page 9: Productivity Enhencement with Visual Studio

JSLintVisual Studio wrapper for Crockford JSLint (Tools > Extensions & Update…)

Page 10: Productivity Enhencement with Visual Studio

Continue...● Unreachable code.

● White space

● Variable declared but not use.

● Variable use but not declare.

● Dead code.

● Not to use with statement.

● Define blocks (if (condition) statement; => if (condition){ statement;}

● Semicolon.

● Debugger statement.

Page 11: Productivity Enhencement with Visual Studio

Css Cop => It uses Css Lint

Page 12: Productivity Enhencement with Visual Studio

Continue...● Don’t use adjoining classes (ex: .foo.bar)

● Remove empty rules (ex: .foo{})

● Use correct properties (ex: display:inline should not use heigh, width, margin,padding,float. Display:inline should not use float, display:block should not use vertical align.

● Do not Use ID as selector.

● Zero values do not need units.

● Avoid selectors that look like regular expressions. (ex: ~=)

● Avoid duplicate property.

Page 13: Productivity Enhencement with Visual Studio

Style CopWork in C# code only

Page 14: Productivity Enhencement with Visual Studio

Continue...Naming rule (ClassName, Method Name, Parameter Name).Curly Brackets For Multilines Statements Must not Share.Element Must Not Be A Single Line.Elements Must Be Separated By Blank LineCode Must Not Contain Multiple Blank Lines In A Row.Do Not Place Regions With in Elements.Use BuiltIn TypeAlias (Boolean => bool, Byte=>byte)Using Directives Must Be Placed Within Namespace.Constants Must Appear Before Fields.Property Accessors Must Follow Order (first get => next set).

Page 15: Productivity Enhencement with Visual Studio

Regex TesterA sequence of characters that define a search pattern.

Page 16: Productivity Enhencement with Visual Studio

Code SnippetSmall Block of Reusable code inserted in code file inserted by menu/hot keys.

● Create New● Use Existing● Update Existing

Example:● ctor + tab + tab => constructor creation.● Equals + tab + tab => Equl method creation.● Try +tab/ tryf + tab => try-catch / try-finally block.● prop + tab +tab => property● forr +tab / foreach +tab => for/foreach loop● Ctrl + k + b => snippet manager window

Page 17: Productivity Enhencement with Visual Studio

Web EssentialsCSS:

● Remove Duplicate Properties● Generate Vendor Specific => word-wrap● Add Missing Standard => -moz-transform : rotate(10deg)● Keep vendor specific in sync => -moz-border-radius: 50px● Extract to File

HTML:● Loren empsum generate (type lorem +tab)● Zen Coding (div.#id, div.class)● Region support (<!-- #regionName → <!-- #endregion -->

Page 18: Productivity Enhencement with Visual Studio

Productivity Power Tool

● Code block identification with light line.

● Solution error visualizer.

● Error filter.

● Ctrl + click for code definition.

● Double click to maximize window.● Power Commands => organize imports, Edit project file, Open command

prompt, copy project reference etc.

Page 19: Productivity Enhencement with Visual Studio

Smart DebuggingDebugging is twice as hard as writing the code in the first place. – Brian Kernighan

● What is Debugging? =>Test for errors or help to determine cause of errors. - wikipedia => MS VS Debugger, Attachment, execution suspend.

● Set/Enable/Disable/Toggle BreakPoint, Conditional BreakPoint, Step Into, Step Over, Step Out, Run to cursor, Set next statement, Modify Variables,

● Various Hotkeys(F9, Ctrl + F9)● Various Debug windows

Quick watch, Autos, Local, Thread, Call Stack, Immediate

● System.Diagnostics.Debugger class.

Page 20: Productivity Enhencement with Visual Studio

Top 11 Visual Studio Cool Features● Start Page● Bookmarking ( ctrl +k + k, ctrl + k + ctrl + w)● File/Member search from solution text box● Move Lines with keyboard (alt + up-arrow/ alt + down-arrow)● Navigate (ctrl + ,)● .NET Framework source trapping. i)

https://weblogs.asp.net/scottgu/net-framework-library-source-code-now-available ii)https://msdn.microsoft.com/en-us/library/cc667410.aspx

● Task List (//TODO:)● Comment as API documentation (<summary></summary>)● Code Map● Outlining (ctrl +M, ctrl + o)● Nuget Package Manager (www.nuget.org)

Page 21: Productivity Enhencement with Visual Studio

Resharper● A developer productivity extension for Visual Studio.

● If is not free. A Jetbrain product.

● Official site: https://www.jetbrains.com/resharper/Feature Category:

● Code Inspector

● Search & Navigation

● Refactoring

● Code Generation

● Code Assistance

Page 22: Productivity Enhencement with Visual Studio

Code Inspection● Red color indication when wrong (base class declaration)

● Import all the right namespaces at a time.

● Visual clue for unused namespace

● Object initializer

● Loop => lambda expression

● Null Checking Notification

Page 23: Productivity Enhencement with Visual Studio

Search & Navigation● Disassemble then show the code source

● Find reference more powerfull then built-in Visual Studio feature

● Interface implementation search.

● Search file (ctrl + t), Camel Case, weild card

● Search Type/Member

● Search symbol (ctrl + p)

● Current File Selection (ctrl + l)

● Navigate To

Page 24: Productivity Enhencement with Visual Studio

RefactoringsEffectively restructure code without changing functionality.

● Rename● Safe Delete● Class Refactoring (Separate class)● Move to File● Extracted method.● Implicit /Explicit Type● Convert to auto property● Identify Unused variable, unreachable code, Redundant else part and quick

fixes.

Page 25: Productivity Enhencement with Visual Studio

Code generation● Generate parameterized constructor

● Interface implementation (IEquable<T>)

● INotifyPropertyChanged(thread safe way)

● String interpolation.

● String to Json/ String to xml

● Derived Type.

Page 26: Productivity Enhencement with Visual Studio

Code Assistance● Looking all assembly with abbreviation (ex:inpc)

● Automatic add using statement (IDictionary<>)

● Show interface implemented classes (IDictionary<string, int>)

● Auto add assembly reference when type new type name.

● Go to code definition in external file or disassemble.

● Unit test runner

● Code analysis

Page 27: Productivity Enhencement with Visual Studio

Conclusion● Visual Studio features Vs Resharper features.

● Think about investment of money (license product).

● Set default hot key selection.

● Hardware checklist (4 GB free, SSD for resharper cache, 1 GM pagefile, 15% free disk).

● Compatibility issue (CodeRush, JustCode, Productivity Power Tool).

Page 28: Productivity Enhencement with Visual Studio
Page 29: Productivity Enhencement with Visual Studio

THANK YOU ALL!