‘How do I learn computer programming?’ is a question which often arises in the minds of engineering graduates as soon as they complete their course. In my experience, a computer programmer must have good technical skills to develop programs, but he must also focus on acquiring a few critical skills along with programming, i.e.,
- How to troubleshoot and analyze a problem (problem solving skills).
- The best way to develop an approach(solution) for solving a problem (critical thinking skills).
- Test the approach to make sure it accurately addresses the problem (debugging).
- Unit test the application to ensure the change did not break the existing functionality anywhere.
A computer program starts with a problem. Your job as a computer programmer is to identify and understand the problems you are assigned to solve so that you can develop an effective solution. Below are the few steps to follow during troubleshooting the bug/issue/exception :
- First, check with the log files created (Event logs,SQL logs and any custom logs you created in the application) to figure out where exactly the problem exists.
- Type in the exact text of your error message into a search engine and see what emerges. Look for forums related to your platform or component and see if anyone has confronted the same issue which would save your time.
Troubleshooting in Application level:
There are several tools that can be used to measure how long a web page is loaded. Fiddler, Internet Explorer Developer Toolbar, and Firebug are three commonly used tools.
Fiddler is a web debugging proxy tool which logs all HTTP(S) traffic between client and web server. It is free and can be downloaded from www.fiddler2.com. Below screen shot has the key features mentioned which are supported by Fiddler:
Capturing Memory Dump
Memory management also makes the difference for any application to get stuck.To determine which part of the application runs for that long, we can usually use memory dump tool, DebugDiag, to capture several memory dumps at the moment we feel application was stuck.Below screen shot gives the steps to enable the memory dump setting for the system.
Analyzing Memory Dump
After memory dumping, the dumped memory files can be loaded back into DebugDiag and used to generate the memory dump report. From the memory dump report, we can easily see which function was executed, and we can go back to the source code to find that function and analyze why it ran for that long, have unit test for that piece of code with similar environment provided to see whether we can reproduce the long running situation in a development environment.
Enabling the IIS logging
IIS logs will help a programmer to troubleshoot the issues before reaching the application layer. IIS can save log files to different file formats. When you enable logging, you can specify the file format that you want to use. By default, IIS uses the W3C Extended log file format. Typically, the W3C Extended log file format is the preferred log type to use. This log format lets you configure lots of extended attributes that are useful to help analyze security. Below screen shot has steps to enable the logging functionality in IIS: