Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Adding flexibility and facilitating object reuse – PB Docs 2022 – PowerBuilder Library

Adding flexibility and facilitating object reuse – PB Docs 2022

Adding flexibility and facilitating object reuse

You can use exception handling to add flexibility to your
PowerBuilder applications, and to help in the separation of business
rules from presentation logic. For example, business rules can be stored
in a non-visual object (nvo) that has:

  • An instance variable to hold a reference to the presentation
    object:

  • A function that registers the presentation object

    The registration function could use the following
    syntax:

  • Code to call a dynamic function implemented by the
    presentation object, with minimal assumptions about how the data is
    displayed

    The dynamic function call should be enclosed in a try-catch
    block, such as:

    This try-catch block catches all system and user-defined
    errors from the presentation object and throws them back up the
    calling chain (to the object that called the nvo). In the above
    example, the thrown object in the CATCH statement is an object of
    type Throwable, but you could also instantiate and throw a user
    exception object:

Code for data processing could be added to the presentation
object, to the business rules nvo, or to processing objects called by
the nvo. The exact design depends on your business objectives, but this
code should also be surrounded by try-catch blocks. The actions to take
and the error messages to report (in case of code processing failure)
should be as specific as possible in the try-catch blocks that surround
the processing code.

There are significant advantages to this type of approach, since
the business nvo can be reused more easily, and it can be accessed by
objects that display the same business data in many different ways. The
addition of exception handling makes this approach much more robust,
giving the application user a chance to recover from an error
condition.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x