[stackoverflow] [progress Openedge Abl] Structures Or Javascript/json Objects In Progress Abl?

Status
Not open for further replies.
D

Daniel Pliscki

Guest
We're migrating to 11.6 and I think it's a great moment to rethink old habits and improve some concepts.

On of this things is the way we've been dealing with parameters definition in functions and procedures.

Often times we have procedures and functions that need a lot of parameters, either inputs or outputs. Personally, for readability and maintenability reasons, I don't like to have methods with too many parameters explicitly declared.

In order to avoid this problem and still allow a large number of parameters, we've manually implemented a key-value pair approach with a single parameter.

But there are some drawbacks with this approach:

  • It's not possible to tell which parameters are needed just inspecting the method signature.
  • You'll always need some boilerplate code, like methods for pushing and pulling values.

So with that said, I would like to hear some thoughts of yours. Have you ever implemented something similar?

Is there something that could work as a javascript/json object in ABL?

Current implementation.

DEFINE VARIABLE param as CHARACTER NO-UNDO.

addValue('id', '1', param).
addValue('date', STRING(TODAY), param).

RUN internalProc (INPUT param).


Desired implementation

param.id = 1
param.date = TODAY

RUN internalProc (INPUT param)

Continue reading...
 
Status
Not open for further replies.
Top