March 01, 2017
In the previous blog
we discussed the latest RPG enhancements. Today we will briefly review the latest RDi enhancements. RDi doesn't typically follow the same announcement schedule as IBM i and as of late has started "sneaking" enhancements into fix packs. The latest of these, which take the product to version 184.108.40.206, includes the foundations for what promises to be a really interesting and useful feature for RPGers: Refactoring.
In case you're wondering, "What’s refactoring?" you're not alone. It’s a very broad term that applies to "the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure," according to Martin Fowler, an early proponent of code refactoring.
By that definition, many of our readers have already done quite a bit of refactoring of their RPG code, by converting existing fixed format RPG code to various iterations of free format. Some have simply done that "by hand" and others by using various tools available for the task, some of which we discussed here
. You probably just thought of it as a "conversion" but apparently, we were all actually refactoring our RPG code. Who knew?
So what has RDi added to support other kinds of refactoring? In this first step, IBM has enabled tooling to help RPGers rename things, including stand-alone variables, data structures and/or subfields as well as procedures and file or record format names. The support is quite impressive. For example, it includes a powerful side-by-side preview capability--similar to the compare and merge facilities we've used in RDi before--so that you can review and approve each proposed change before it’s made.
If you're wondering how this is different from a simple, global, find/replace action, consider some of the following points. Suppose you want to change variable "Work" to be "WorkOut". Find/replace would change all occurrences of those letters, so fields named "WorkDay" would become "WorkOutDay" and a procedure named "GenWork" would become "GenWorkOut". RDi's refactoring understands RPG syntax and thereby ensures that only references to the variable "Work" are renamed wherever and however it’s referenced in the code.
Likewise it’s fully aware of RPG scoping rules, so it would only change references to the variable named "Work" within the scope of the selected variable. Even if you want to rename a global variable, it’s smart enough to figure out that a local variable with the same name inside a procedure should not be renamed.
To try this support, simply select (double click) on the name of something, right click and then choose "Refactor > Rename…" from the context menu.
Renaming is just the beginning. The developers of RDi would like guidance from RDi users on what other forms of refactoring would be useful. If you're a regular reader of our blog, you probably know what's coming next … review any RFEs that may already be out there to add your votes to the most important ones and if you have a refactoring idea that isn't already out there, add it. Just in case you've missed all of our many posts about RFEs in the past, check out this one
to get started with RFEs.
But Wait--There’s More
Version 220.127.116.11 also includes a new preference that allows you to specify that you want the default behavior for a double-click on a source member to be to open the source in browse rather than edit mode. This is a long-standing request that we have often heard from programmers who man the Help Desk and who need to review code without being able to change it.
There were also many fixes for reported problems. This is technically a "fix pack" after all! Just in case some of those were issues that affected you, you may want to check out the announcement details from IBM
. You may also want to check out a post on the RDi Hub
that has a PDF covering details of both this latest fix pack and the previous release, 9.5.1.
Perhaps the biggest thing about this new version is not the details of the enhancements per se, but rather that they derive from customer requests and re-affirm that the RDi team are good listeners! Keep those RFEs coming; IBMers are certainly listening.
Posted March 01, 2017 | Permalink