Sheerpower Logo

C.3  Coding Insights


Maximizing Code Quality with SheerPower's Option Insights

Coding Insights empowers developers to write higher-quality code by providing real-time guidance during compilation. This feature reinforces best practices and encourages efficient coding habits, making development smoother and more productive.

SheerPower’s option insights enables the compiler to collect detailed metrics during compilation, generating a comprehensive Coding Insights Report. By analyzing code complexity and structure, this tool helps developers create code that is easier to develop, test, and maintain—enhancing both efficiency and reliability.

Enabling Option Insights

To enable insights, simply add this to the top of your program:

option insights

SheerPower tracks various metrics during compilation and automatically generates a detailed insights report at the end of the process.

Note: To use insights, you must install SheerPower. Insights are generated when option insights is enabled and you validate or deploy your program.

Generated Report

The insights report provides the following key details:

  1. Lines of code, number of routines, and variables.
  2. Complexity level per routine.
  3. List of most complex routines.
  4. List of unused variables -- they are given values but never used.
  5. List of unused routines -- they are defined but never called.
  6. Literal counts.
  7. Suggestions for optimization.
  8. and much more.

Note: The insights report is generated as an HTML file named myprogram_insights.html, where myprogram is replaced with the name of your program. You can open this file in any modern web browser to view the report.

(Show/Hide An Interactive Insights Report)

Interpreting the Scores

The report assigns a Complexity Level score to each routine:

(Show/Hide Understanding Complexity Level)
  1. 0-10: Simple (Good)
  2. 11-20: Moderate (Review for improvement)
  3. 21+: Critical (Refactoring needed)

The report assigns a Lines of Code (Adjusted) status to each routine:

  1. 1-30: Simple (Good)
  2. 31-90: Moderate (Review for improvement)
  3. 91+: Critical (Refactoring needed)

The report assigns a Literals Usage status to each routine:

  1. 1-15: Minimal (Good)
  2. 16-30: Moderate (Consider refactoring)
  3. 31+: Excessive (Refactoring needed)

Best Practices

To make the most of option insights, consider the following best practices:

  1. Regularly check complexity scores during code development.
  2. Refactor high-complexity routines to improve maintainability.
  3. Use named constants for frequently repeated literals.
  4. Minimize deep nesting in logic-heavy functions.
  5. Review the insights report often to ensure code quality.

Conclusion

SheerPower's option insights provides a valuable way to assess and optimize code complexity. By reviewing the generated report and applying best practices, developers can maintain clean, efficient, and scalable SheerPower applications.

Hide Description

    

       


      

Enter or modify the code below, and then click on RUN

Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use.