- Daniel Vivier
- PowerBuilder
- Thursday, 5 September 2019 08:41 PM UTC
We have a common PBL used by two different applications. It is compiled separately and used as a PBD by those applications, so it has no access to objects or global variables etc. in the application PBLs.
I have a situation where I have a window in both applications, that is almost identical in each, except for small amounts of different code, where the different parts need to access global variables from the applications. I'd like to move that window to the common PBL, but have to have a good way to have it access the applications' code for those different bits.
Obviously one option is to have a base window with most of the code in the common PBL, and inherit it in each application PBL, overriding or extending some code. The thing I don't like about that is the way PB compiles inherited objects, by including all of the code from the ancestor object in the compiled inherited one, leading to compiled code bloat. (We sell our software to small churches, many in the countryside, and thus some of whom may still have very very slow Internet for downloading applications!)
One solution I have used in the past is to design a function to do the distinctive parts, put a no-op version of that function in the common PBL, and real implementations of it in each application's PBL, which will override it since they are earlier on the library list. That works, and would have very little code bloat, but seems a bit ugly.
For cases where groups of functions are needed, presumably I could do the same idea with an NVO, with several no-op functions in a copy of it in the common PBL, and real implementations of the required different code in each application's PBL.
Any better ideas? Thanks.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.