Code Analytics Introduction¶
The majority of Progress 4GL code in existence was written 10 or 20 years ago. In the intervening decades, technology has changed significantly and customer requirements have changes to match. For this reason, most large 4GL applications are undergoing a significant refactoring and modernization effort.
It is exceptionally difficult to refactor or modernize 4GL application code. To do it properly, one must thoroughly understand the existing implementation and its dependencies, so that the improved code does not lose or break functionality in the current code. This typically means a great deal of manual investigation of the code and schemata. This can be error prone and very time consuming, especially when the 4GL code is ambiguous or complex. Often, developers spend a great deal of time trying to grep through source code, hoping that their regular expressions are matching all of the abbreviated mixed-case keywords needed give some idea of what is going on.
The FWD open source project has tools which preprocess and parse entire ABL applications, converting the source code and schemata into Abstract Syntax Trees (ASTs). These tree data structures represent the code and database structure in its most pure form, without syntactic sugar. Abbreviations, case sensitivity, whitespace, keyword ordering and many other problems drop away at this point. FWD provides a rich set of tools to inspect, analyze, search, manipulate and transform these ASTs. These tools automate this processing across an entire application, allowing even the largest of applications to be analyzed and transformed.
FWD includes a code analytics toolset that provides unique and powerful capabilities for the deep analysis and inspection of ABL code and schemata. Instead of using text searches, FWD is syntactically aware of the ABL code. It is trivial to answer a question like "show me all locations in the application which use a CAN-FIND on the CUSTOMER table and in the WHERE clause there is a reference to the ORDER-NUM field of the ORDER table as an operand to the EQ or = operator". Using FWD, you will find an exact answer to this question and there will be no doubt that you found all instances of these references.
In addition to ad-hoc search and inspection, FWD has an extensive set of pre-defined reports and statistics, a web-based interface for searching, reviewing reports and a source code view that shows the code and the AST side by side.
Taking this further, FWD also provides a call-graph analyzer that allows one to create and explore the call graph for the entire application. One common usage is to drop dead code out of a project. Being able to explore the call graph is invaluable in a refactoring or modernization project, because some questions can only be answered by knowing what code can call a particular target entry point. The call graph is visualized and explored using the same web interface.
Why Use FWD Code Analytics?
- Reduce development effort.
- Improve code quality.
- Deeply understand and explore existing code.
- Empower developers to more capably handle:
- The most complex refactoring, transformation and modernization problems.
- Making changes at scale (across the largest of applications).
The FWD technology was created to implement the fully automated transformation of Progress 4GL application source code and schemata. As a result of this work, it was a natural requirement to be able to look deep inside 4GL applications and to be able to analyze and categorize application code and schemata based on the very syntax of the language itself. The tools documented in this book are the result of those requirements.
FWD v3.1.0 provides a new set of Code Analytics tools which is a major rewrite and improvement of the Reporting tools. In addition, a significant upgrade to the Call Graph Analyzer is included. An early version of that code was recently shown at the PUG Challenge Americas. The details of the work that implemented these improvements can be seen in tasks #1514 and #3277.
The rest of this book will focus on how to install and use the Code Analytics tools on projects that are arbitrarily large and complex. Get started by following the instructions in chapters 3 through 9.
© 2004-2017 Golden Code Development Corporation. ALL RIGHTS RESERVED.