Code Analysis what does it do for your application ?

Baron Software

Code Analysis what does it do for your application ?

When developing an application you want to provide the best solution for your clients.  This means you need to evaluate current or possible future defects in your source code.  This is a reality during the development stage and is highly recommend that this is implemented in all cases.

Necessary steps to do during the code analysis

  • Identify potential errors and oddities.
  • Identify from the produce warnings on why and how you can remove them.
  • Check your code for coding convention compliance.
  • Team code review.

There are numerous packages that can be purchased to do simple to deep analysis.  Some packages are installed with the IDE you are using or are external but all have the similar need.  They have to have access to the source code to review it.

What is static analysis?

Analyzing code without executing it. Generally used to find bugs or ensure conformance to coding guidelines. Static analysis tools should be used when they help maintain code quality.

Two common pathologies occur when using static analysis tools:

  1. The tools produces spurious warnings/errors that the developers cannot silence.  The source code must be compiled cleanly without the failure.  By ignoring compiler warnings, the compile phase will eventually be filled with warning nobody ever pays attention to with the possibility it leading into issues later.
  2. The tools take too long to run and developers never bother to run them.

For the Delphi IDE the recommendation for tools can be TMS Fixinsight, Code Healer, etc.

For the Visual Studio it has a built in code analysis which can be accessed from the menu.

Using a code analysis application or from the menu such as the case in Visual Studio provides you with the possibility of stopping future bugs occurring.   It is highly recommended to compile cleanly, have a code review and finally allow QA to test the application before going to market.