DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦c23dd08b0⟧ TextFile

    Length: 5384 (0x1508)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦3febc57a8⟧ 
            └─⟦this⟧ 

TextFile

~heading(~center(Static Analysis of Ada))

The tool ADAMAT by Dynamics Research Corporation provides one approach
to static analysis of Ada code.  The basic approach is to

~startnp

~np
Compute the number of occurrences of Ada constructs that diminish the
quality of an Ada program from a simplicity, maintainability, clarity,
and portability perspective.

~np
Compute the relative number of "bad" constructs to "good" constructs
on the same kind.

~np
Combine these raw metrics with user defined weighting factors to
compute and overall "simplicity" and "maintainability" ratings.

~endnp

There are a few shortcomings with this approach:

~startnp

~np
The tool may count instances of "bad" coding constructs, but the
user does not know where in their code those instances are located.

~np
The rating numbers are very hard to interpret.  It is unclear which of
the factors contributed most significantly to the overall rating. 

~np
The tool runs very slowly, processing Ada units at a rate of about
5 lines/minute on a moderately loaded machine.

~endnp

Rational has built a tool that collects a subset of the ADAMAT metrics
and displays them in table for inspection by a QA engineer.  The following
example displays a table of metric values collected for some Ada units:

~begin(verbatim)
Key : 
  Metric                                    Reference                
  =================================  =========================  
  Number of Use Clauses                        Uses                  
  Number of Goto Statements                    GoTos                  
  Number of Predefine Numerics                Predef               
  Number of Uninitialized Variables           Un-init                 
  Number of Anonymous Arrays                   Anons                  
   

Unit Analysis : 
  Unit                   Uses  GoTos  Predef  Un-init  Anons  
  ====================== ====  =====  ======  =======  =====  
  Analyze'body              2      1       6        4      0  
  Analyze'spec              0      0       0        0      2  
  Branch_Utilities'body     1      1       3        3      0  
  Branch_Utilities'spec     0      0       0        0      0  
  Globals'spec              0      0       1        2      1  
  TOTAL                     3      2      10        9      3
~end(verbatim)

Rational calls these "hyper-text" tables.  Each element of
the table is "electric" allowing the user to travel directly to each
occurrence of the offending construct.  If the users selects a number
in the table and presses the appropriate key, the Ada code containing
the construct is displayed on the screen.  If there is more than one
construct listed a menu is provided allowing the user to select
the construct that he or she would like to visit.  Pressing a second
key will provide the user with help, providing explanation of the metric.

This mechanisms allows the QA engineer the opportunity to scan the
metric data looking for potential problem areas.  When a potential
problem is located the user can visit with the offending code to
perform additional analysis on whether there is an actual problem.

The possible advantages of this approach are:

~startnp

~np
It offers a much more interactive way of evaluating code for its
quality.  The user can identify potential problem areas, then
check if a problem actually exists.  No construct is always bad
or always good.

~np
Although only about 10 ADAMAT metrics were computed here, all of
the other metrics could be implemented easily on top or Rational's
DIANA database.  The tool is completely extensible allowing additional
metrics to be built by the user and incorporated into the report.

~np
The tool runs very quickly since it is optimized by Rational's DIANA
database.

~endnp

In additional to providing the subset ADAMAT metrics described above,
Rational also provides additional analysis tools that are based
on a semantic analysis of the program.  Each analysis tool places the
collected information in a hyper-text table described above.

~startnp

~np
Profile the kind of statements, declarations, pragams, and type definitions
used within a program

~np
Compute Set/Used information on all object declarations within a program.

~np
Locate all unused declarations within a program.

~np
Compute the size (in target bytes) of all object declarations.

~np
Locate all type declarations and sort them by kind.  Provide bounds
information for numeric types, index and component types for arrays, and
other miscellaneous information about each type.

~np
Analysis of a record types, sorted to exposed commonality 
among component fields.

~np
Explode any type declaration to show all components in the
data structure and their size in bytes.

~np
Locate all subprograms that are candidates for inline expansion.

~np
Locate all Others clauses present in case statements, aggregates, and
exception handlers.

~np
Locate all allocators where dynamic objects is created.

~np
Locate all renaming clauses to insure that a consistent set of
renaming is being performed.

~np
Locate all tasks within a program and display all entry declarations
and entry calls made between tasks.

~np
Provide an analysis of all program branches within a subprogram.

~np
Analyze all generics to find one instantiated only once.
Provide a comparison of each instantiations to identify commonality.

~endnp