Seven Tips To Increase Your Productivity

Writing robust code and finishing projects in a short time are the main characteristics of a professional job, so every developer should focus on his/her productivity to create efficient code in a short time.

In this article, I will present seven important tips to achieve the previous goal which needs a little bit of training to get used to.
  1. Using Visual Studio Code Snippets
    Code Snippets are some shortcuts of a reusable block of code that can be inserted into the code file using the context menu or some hotkeys, they typically contain commonly-used code blocks, such as if-else, try-catch, loops (for, while, do while) and also you can create classes and methods with code snippets.

    Example of using code snippets in C#: If you want to create a foreach loop, instead of writing the whole code you can just write foreach and tap twice and the foreach loop will be written automatically. Also, you can do the same thing with try, if, while, prop to create a property and many other snippets. To know more about snippets and how to create your own check the following link https://docs.microsoft.com/en-us/visualstudio/ide/code-snippets

  2. Smartly use Visual Studio IntelliSense
    IntelliSense is a general term of a variety code editing features: code completion, members info and more. 
    Using IntelliSense to complete your code is a good factor to increase your code writing speed, for example: if you want to write
    1. Console.WriteLine("");  
    You can Write Conso and hit tap, then IntelliSense will complete the word Console and instead of writing WriteLine, you can only write WL and IntelliSense will continue WriteLine for you.

    Maybe IntelliSense completes only a few letters, but in long code it will reduce  coding time and it will help you to check the spelling of the words and whether the member you write such as variable or method is existing in the context or not. 

  3. Try not to use the mouse while you are writing  code
    The keyboard contains shortcuts to the functions you need to deal with text, such as copy, cut, paste, select letter, word, line, whole text and navigating the cursor between the text and more.

    The most common keys to use are: Shift, Ctrl, Home, End, PageDown, PageUp with arrows for example,

    Shift + End
    Select the text within the cursor position and the end of the line.

    Shift + Home
    Select the text within the cursor position and the beginning of the line.

    Shift + Ctrl + Right Arrow or Left Arrow
    Select a word.

    End
    Move the cursor to the end of the line.

    Home
    Move the cursor to the beginning of the line.

    So getting used to using these keys together will help you to write code quickly.

  4. Always use the keyboard shortcuts to execute commands and navigate between files in Visual Studio
    Visual Studio provides you with many important keyboard shortcuts to call many functions which help you achieve your job quickly such as,

    Ctrl + Shift + B
    to build the project.

    F5
    to debug the project.

    Ctrl + K then Ctrl + D
    format the code(do the proper alignment of your code), remove white spaces and more.

    Ctrl + K then Ctrl + C
    Comment a line or a block of code.

    Ctrl + K then Ctrl + U
    Uncomment a line or a block of code.

    Shift + Alt + C
    Add a new Class.

    Shift + Alt + A
    Add a new item. 

    Ctrl + Tab
    Navigate between opened files.

    And there are more shortcuts for other functions.

  5. Try not to repeat your code
    Writing a code that makes the same job multiple times is a big mistake which will waste your time and make your code bigger, so always you should create functions and methods in one place and call it when it's needed, also try to put all your commonly used codes in a library and reference them in other projects, this will help you to reduce the coding time in future projects, and write an organized code as well.

  6. Use the Find and Replace built-in functions in Visual Studio
    Find function can easily assist you to find what you are looking for in a specific file or all over the solution instead of searching for something manually by navigating files.

    Replace 
    is another helpful function that you can use to replace a specific text with another with some useful properties such as matching words that are case sensitive or not and other cool properties which simplifies the process.

    You can use these function from the 'Edit' menu then Find and Replace,


  7. Organize your project's files in well-named folders
    No projects consist of one file or even one type of files, always you will use many classes, images, controls and other files, so it is a good approach to create a folders with a clear names and put each file in its right place, so it will be easy for you to find, change or maintain anything in the future, such as if you create a user's controls in your project, they are a normal classes but it is a control to use it in the interface so you can put all these types of classes in a folder named 'UserControls'.

    This approach can be helpful when you want to make updates or fix some bugs in the project, you can find the targeted file easily.