How green is your application?
Overview
Are you interested to find out whether your application uses specific programming practices that could be damaging to the environment, i.e, by requiring more CPU than necessary? CAST can provide this via a list of checks focused on programming practices and engineering principles that could be detrimental to the environment. These checks are run against your application during the analysis and any code that violates these checks is flagged and displayed. For example, checks such as “Avoid queries without WHERE condition” - i.e. flagging SQL queries that return many results resulting in increased processing power and time to complete.
This article explains how to quickly identify the use of environmentally deficient components in your application using CAST Imaging, therefore making their upgrade or removal a much easier and safer task.
How does this feature work?
The information about green deficiencies is provided by CAST Highlight’s SCA database: see the list of checks here: https://doc.casthighlight.com/greenpatterns/ .
You will therefore need a CAST Highlight subscription in order to leverage this feature. In addition, your application must be fully analyzed in CAST Imaging ensuring that the extension com.castsoftware.highlight2mri is installed.
How do I find out where the green deficiencies are located?
Your application needs to have the Ready to view status in the Landing page:
Then click Ready to view, expand the Assess green impact and select the “Green Deficiencies” tile:
Clicking the Green deficiencies tile will display the following screen, where a list of “green deficiency” type checks provided by CAST Highlight will be displayed in a left-panel with a corresponding object view to the right:
Scope
First choose the scope of the list of deficient components. These are categorized by transaction, and by default all transactions are listed. You can limit the scope by selecting a specific transaction:
Then choose the Green Deficiency check that interests you - each component that violates this check is listed underneath:
Item | Description |
---|---|
1 | A clickable link directing you to an explanation of the specific Green Deficiency check, provided by CAST Highlight. |
2 | Clicking the Tag button will enable check boxes to the left which allow to to included specific components in the tag. |
3 | Export all the components violating the current check to .csv file. |
4 | List of components violating the current check. |
Where are the green deficient items used in my application?
Once you have a list of the green deficient items, the next step is find out where these components are being used in your application so that you can plan to update them. The right panel shows a high-level view of the items containing the deficient code. Clicking the Open in a new view button opens up the relevant objects and nodes in full screen mode. A hypothetical example is explained below.
Example
Take the following example where the check “Prefer comparison-to-0 in loop conditions” has been violated a number of times. Look at the right panel high-level overview to see the impacted component, all items it calls directly and any additional items involved in links between called items:
Next click the Open in a new view button to drill-down to the details - this will help you understand the impact of updating the item, or if you want to remove it entirely.
You can also save this information as a view in order to plan the update, use the export feature or compare the objects with a previous analysis state:
It is also possible to view the exact piece of source code that defines where your custom object is calling the the class - click the link between the objects to do so:
Finally, you can add a Post-It to the view to inform your co-workers what needs doing: