Welcome!

PowerBuilder Authors: Dan Joe Barry, Carmen Gonzalez, Ian Thain, Yakov Werde, Paul Slater

Related Topics: PowerBuilder

PowerBuilder: Article

Enable Runtime Explorer with Automatic Source Change

Presenting the runtime-driven development cycle

ESC carries out the following activities:
  1. Accepts a transaction file (.ESC) with commands grouped by library and by object
  2. Verifies the syntax of the commands
  3. Checks out the objects (if SCC is used)
  4. Makes the source code changes, identifying the specific object and the specific property/script
  5. Backs up the PBLs concerned before importing the changes
  6. Imports the changes into the libraries
ESC handles all types of errors and prevents the import of objects subject to processing errors. Libraries aren't corrupted by incorrect commands; the backup copy (always made) can be restored using the Restore Manager. In addition, ESC supports SCC systems.

Why ESC Rather than Search&Replace?
Multi-file search and replace has been used for years and is fine for making global changes, but is extremely risky when it comes to the small local changes made by ESC.

What happens if you need to change the Text property of a SingleLineEdit in a window? It's easy to open the relevant .SRW file, but now you need to find the SingleLineEdit object and look at its properties to make the change. Alternatively, you can look for the source code concerned (definition of the SLE control) and hunt through the properties. Perhaps you need to ignore spaces and letter case. In short, not an easy task for a text editor...

In another situation, you know that some properties (e.g., datawindow.titlebar) aren't specified in the source code if their value isn't "true"... in this case, a new line of code is required to change the value and S&R won't do.

Lastly, when you're working with PBUs, you have to consider the tolerance! Often, the size of an object in runtime differs from that indicated in the source code: how can you look for something that's not exactly what you expect to find?

ESC Uses Parsing Technology
ESC can make these small local changes because it's based on the parser used by Enable for PowerBuilder (which makes PB applications multilingual). This parser recognizes PB grammar, finds the various components in the source code and identifies the specific part to be changed.

Source Value, Old Value, New Value
Before making a change (New Value), ESC checks that the value of a property or script in the source code (Source Value) is equal to (or compatible with, as in the case of coordinates) the Old Value captured in runtime when the change was made. This avoids two unwelcome effects:

  1. If the value has been changed by two developers (at different times), the second change is rejected. For example, two developers might change the position of a button starting with the same build of the software; in this case, without the check made by ESC, the second developer would unknowingly overwrite the change made by the first developer!
  2. Changes to dynamic properties that may have undesirable effects (documented however in a report): changing the where of a dynamic SQL statement would change the original statements and compromise the application logic.
ESC therefore applies runtime changes to the source code, avoiding unwelcome side effects. In addition, where needed, ESC can also ignore the Old Value and write the New Value directly to the source code.

Source Code Control Interface
If the workspace uses a Source Code Control system, ESC can automatically check out the required objects. The object then remains checked out and the developer has full control over when to release it. If the object can't be checked out, ESC can either apply the changes on a simulated basis (using a local copy of the object) or reject them.

LibraryImport
Before importing the changed source code, the library is added to the zip file used for the session backup. In the event of problems, the transaction can be reversed and the objects recovered from the backup file.

Only objects that haven't encountered problems in the earlier stages of the runtime development cycle are imported into the library. The changes can be confirmed simply by running the application.

ESC uses PBORCApi from Roland Smith (TopWizProgramming) to import source code into the libraries and to check out objects.

Rex Versions
Three configurations of Rex are currently available:

  • Enterprise: unrestricted (developer license, royalty-free deployment)
  • Professional: Rex can't be used with the application's executable files
  • Standard: Can't write new plug-ins, no more than five change commands can be sent to ESC in each session, no SCC support
For further information about Enable Runtime Explorer, see: www.enable-pb.com.

More Stories By Gian Luca De Bonis

Gian Luca De Bonis is CEO/CTO of Enable Development, a London-based software house. He has considerable international consultancy experience, primarily focused on PowerBuilder, database technologies and software engineering.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.