7. Powerful Code Analysis

InstantC's code analysis features will quickly become central to your development approach, because of the improved understanding and control they provide for even the most complex applications.

Unlike other environments, InstantC lets you examine the structure of your source code from more than one perspective. Drawing on the program database InstantC maintains for your application, the browser and cross-referencer let you view your program starting from a high (file-oriented) or low (source element-oriented) level. This lets you easily understand and control both an application's overall structure and its individual source elements, such as its function and data definitions.

You can quickly see all the files that make up your application, and the source elements each one contains. You can easily find the definition of a function, or all the references to a data variable. The time you spend hunting down information is virtually eliminated. The time it takes to understand complex inherited code is greatly reduced, and your ability to create strong, well-designed code is enhanced.

True Browsing of Files and Source Elements

As the complexity of your applications rises, it gets harder to keep track of the files that make them up, to say nothing of the source elements in each file. In a moderately complex Windows application, you may have dozens of files devoted to interface handling alone, each containing dozens of variables, functions, macros, typedefs, and so on. It's hard enough to manage that many files and elements when you're dealing with a program you created yourself; it's even harder when you're trying to understand an application someone else wrote.

The complexity of such applications increases your need for a high-level view of program structure. You need to know what files make up your application and what's in them. You need to know that you have grouped functionality logically, and that you have not duplicated code needlessly. You need to know that the structure you have designed is logical and consistent. Just as important, you also need the ability to correct errors in your design. InstantC's code browser makes all this easy.

The browser, shown in action below, gives you an overview of all your source code. It allows you to see the structure of large projects, making maintenance easier. It also lets you "zoom in" on individual files so you can see -- and edit -- what they contain.

[image]

When you invoke the browser, it first shows you a list of all the program files you have loaded. You can immediately select any of these files and edit it.

You can also display a list of all the source elements contained in the file, arranged in the order you select: alphabetically, in order of declaration, or grouped by category (function definitions, #defines, and so on). You can create as many of these source element lists as you want, one for each file you want to know more about, and keep them all on screen at once as reference windows.

From any source element list, you can select individual elements and bring them into the editor. This makes it very easy both to correct or enhance individual pieces of code and to move them around from one file to another, improving your overall application design.

Flexible Cross- Referencing

Just as important as control of overall application structure is the ability to analyze the fine details of code. When you're debugging, it's important to know as much as possible about the source elements involved, including their connections to the rest of your code. What is the source element's exact definition? Where else is it used? What elements does it use itself, what are their definitions, and where else are they referenced? Without this kind of knowledge, fixing one bug can easily result in the introduction of others. Controlling such ripple effects, especially in complex code, calls for the ability to quickly see connections and dependencies between source elements. The cross-referencer, shown working below, helps you examine these connections.

[image]

When you invoke it, the cross-referencer helps you find the source element you're looking for. You can search based on a complete name or the first few letters of a name. You can even search for approximate name matches, and have InstantC show you names that are similar to the one you specified. You can also have InstantC display matching source elements only in those categories you specify (like functions, macros, variables, and so on).

Once you select a source element, the cross-referencer displays a list of all the memory files that reference it. From that list, you can select a file and edit it, or you can display a list of the items in that file that reference the function or variable. You can, of course, edit those items, but you can also select an item from this list, and display a list of all the files that reference it. You can continue this sequence indefinitely, allowing you to follow a chain of references as far as you want. In this way, the cross-referencer lets you thoroughly (and quickly) explore the nature of a source element, its effect on your program, and how it is affected by other elements. Your debugging time will be reduced, and your enhancements will be safe and effective.


[Previous] * [Tour Index] * [Next]

[Back to the InstantC Home Page]


[Home] * [Tenberry] * [News] * [InstantC] * [DOS/4G] * [DOS/16M] * [Rational Systems]
Last modified 97/04/18, <webmaster@tenberry.com>