Debugging in a few words

I have learned that debugging is about setting breakpoints to check the values of variables.

The variables can be checked as an input, transformation, or an output.

An analogy would be that code is like a factory  that receives materials, processes the materials, and a product emerges from the factory. A quality assurance expert would inspect the materials received, how they are processed, and what results from the processing.


JavaScript Quick Tips

Here are a few JavaScript tricks and tips I have learned.

These lessons were learned working in an ASP.NET, AngularJS, and C# environment using Visual Studio 2013.

  • For AngularJS views, place curly braces in the HTML to see an object and all of its properties, i.e. {{person}} will show all of the properties and values for the person object.
  • Use Internet Explorer with Visual Studio to set break points in the JavaScript file while debugging. Thanks go to Tammy for giving me this tip.
  • Use alert messages and console.log to see the variable’s current value or type. Sometimes I use alert just to make sure the program is reaching the section of code.
  • Send the entire object and use the properties as needed. I was wasting time sending just individual elements when I could have just sent an entire object. For instance, instead of sending:
    name:”john”, age:25
    I learned to just use:
    var person = {name: “john”, age: 25}
    and to send the entire person object.
    Then on the server side I can use setters and getters for a Person object which will have properties Name and Age.
  • Watch out for null and undefined variables. I am not entirely sure how to avoid these problems but I am thinking the solution is to initialize my variables and also set my variables when I reset them.

These tips are pretty basic but hopefully I will be able add even more tips as I fail a lot and make mistakes 🙂 learn and improve even more…




My favorite Visual Studio Shortcuts

Here are the shortcuts I use countless times a day

  • F5 – Starts the debugger and launches the site in the browser. F5 also continues the program to the next break point.
  • Shift+F5 – Exit debuging
  • F10 – Steps over the code.
  • F11 – Steps into the code.
  • Ctrl+F10 – Runs to the cursor. Can also be used by right clicking the mouse button.
  • Ctrl+F – Searches the current file for the specified text.
  • Ctrl+Shift+F – Searches every file for the specified text.
  • Ctrl+H – Replace the specified text.
  • Ctrl+Tab – Show next Visual Studio tab.
  • Ctrl+Shift+Tab – Show previous Visual Studio tab.