Consultor Eletrônico



Kbase P22554: How to narrow down a piece of code ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/2/2004
Status: Unverified

GOAL:

How to narrow down a piece of code ?

GOAL:

How to extract a reproducible from an existing application ?

GOAL:

How to create a reproducible ?

GOAL:

How to troubleshoot language problems ?

FIX:

When troubleshooting an application problem, the first step is to isolate the cause of the issue. The same applies if Progress Technical Support asks for example code or a reproducible case.
To accomplish this successfully, the code involved must be narrowed down to a minimum. The following are a number of pointers on how to do so:

-- Analysis phase --
In this phase, steps are taken to make the problem reproducible as consistently as possible.

1. For intermittent problems, try to determine which database & variable values can cause the issue, if it is dependant on application workload, amount of data processed etc. Also try to determine when it does *not* occur (ie. different connection types to database etc).

2. Determine steps to reproduce based on where and when the issue occurs. Do this as detailed as possible, up to the keys pressed/order in which objects are clicked with the mouse.

3. Determine if a database connection is needed to easily reproduce the issue. A database connection is usually required if:
- The application causes actual server-side database errors
- The behavior is dependent on connection type (remote or self-service client)
- Database triggers are involved (often easier to reproduce with the actual table).
- Corrupted records may be the cause of the issue.
- The behavior occurs when multiple procedures access the same tables.

-- Elimination phase --
In this phase, actual isolation will take place by removing anything that cannot be part of the cause.
This phase has a fair amount of trial and error. A backup copy of the application should be made before any of the following steps are taken, and behavior of the application should be checked regularly throughout the phase to confirm the issue is still reproducible using the same steps to reproduce. Any change of behavior may indicate where the cause of the issue lies, and as such should be analyzed carefully.

4. Remove AppServer connections. Instead of referencing a SERVER object, reference the SESSION system handle instead, thus running everything on the client side.

5. Remove any indexes,tables,sequences and data from the database that cannot be part of the issue.
If at all possible, replace the database references with temp-tables in the procedures involved, thus removing the need for a database connection entirely.

6. Remove any files that are not required to reproduce the issue. This means removing any graphics files, procedure files (such as search screens), include files etc. that aren't required to run the code needed to reproduce the issue.

7. Include files can be made obsolete by replacing their reference with the actual contents of the file (or by using COMPILE ... PREPROCESS ... if no encrypted include files are used).
Super Procedure files can be made obsolete in a similar fashion by replacing the RUN SUPER statements with the appropriate code from the super procedure file.

8. Remove from your application any SmartObjects, widgets, variables, trigger, procedures, database aliases etc. that shouldn't affect the issue. Preprocessor directives can be made obsolete by replacing the preprocessor references with the appropriate code, or COMPILE ... PREPROCESS ... .

9. Remove calling or called external procedures (other .p/.w files).
This means replacing parameters with variables, hardcoding initial values or adding UPDATE statements to set them as necessary to eliminate calling procedures, and/or moving code from the called file into the calling file to eliminate called procedures.

10. Reduce the number of steps to reproduce. This will already happen naturally during the above steps, but also consider hardcoding initial values for variables, changing tab-orders etc. to reduce the amount of user interaction needed to reproduce the issue.

Repeat the above ten steps as needed to reduce the code to the minimum needed. Having done so, it will be easier to identify the root cause of the issue and to determine what further action shou.ld be taken to eliminate and/or avoid the problem..