× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 23 December 2016 at 08:36, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx> wrote:

THe link to the update or maybe to Knowledge Center says there are 4 kinds
of refactoring in view - and they have implemented only 1 at this time.

The original RFE was a very big lift. I'm not surprised the Lab
decided to split it up into multiple RFEs. That said, we as a
community need to go vote for what we want next!

Extract procedure:
https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=98369
This is huge for me. Imagine I have a chunk of code buried in the
middle of a monster program that I want to turn into a sub-procedure.
Today, I Ctrl-2 to open up a second editing pane. In this second pane
I drop to the bottom, run the wizard to create a new procedure. In
the first pane, I select / cut the code. Move to the second pane,
paste the code block, and now try to pull out the global variables and
turn them into parameters as well as to make all the other variables
local. Often, I turn off the dynamic Outline View because I need to
keep a snapshot of what it was like while I'm in the middle of this
refactoring. I personally use RPGUnit as a test framework, so I have
another editor tab opened to my test suite. Putting the new
sub-procedure into a service program - even a temporary one - helps me
immensely because I can quickly find all of the global variables in
the failed compile attempt :-/

Now, imagine that this happens with a click. The Live Outline knows
which variables are global. Imagine seeing them declared at the top
of the new sub-procedure with their proper type and size! Imagine a
parameter wizard that runs when the new sub-procedure is created,
building the DCL-PROC and DCL-PI and then replacing the original code
block with a template CALLP / EVAL! How much can you imagine this
thing can do for you?

Go vote. Add comments. Tell the team. They hear us.

The other refactorings are:
Extract Constant
https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=98365
How many times do we come across a hard coded magic number? A loop
limit for an array (that we need to make larger). An RRN count limit
for a subfile (that we need to make larger). How many times are these
magic numbers the exact same pair of digits as an indicator? Scan and
replace doesn't help much. What I need is to be able to highlight a
block of code and have RDi locate the magic numbers and replace them
with a named constant. Leave the indicators, take the constant :-)

Extract Local Variable
https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=98367
This basically converts a function cal to a variable. Whaaa? Imagine
you have something like this:

if %substr(getCustName(getCustId(salesHistoryId)): 1: 1) = '*';
// special handling customer
...
endif;

Now let's say you wanted to debug that thing. In particular, you want
to *force* the IF statement to be true. How do you do that? Extract
local variable:

firstChar = %substr(getCustName(getCustId(salesHistoryId)): 1: 1);
if firstChar = '*';

Highlight the function call, Extract Local Variable, and the IF gets
replaced with a variable, the variable gets populated with the
function call, and I can force the IF to execute in debug. Or with a
test suite. Visually oriented people can see it in action in Java
here https://youtu.be/VHI70vXoOnc?t=1m7s

--buck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.