[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Unexpected lifetime of dataset member (REFERENCE-ONLY)

  • Thread starter Thread starter frank.meulblok
  • Start date Start date
Status
Not open for further replies.
F

frank.meulblok

Guest
I think the distinction between BIND and BY-REFERENCE is reasonably well documented here: documentation.progress.com/.../index.html So what happens in the problem scenario is actually expected: In the ClientTestMethod1() in the test harnass, the initDataMethod1() doesn't get called, so the v_Init:BindNewBomData(OUTPUT DATASET DS_AsmBom BIND) never happens and the reference in your BomLogic stays unbound. The BY-REFERENCE pass to TestMethod1() will set up a temporary binding (which allows that call to complete) and will then unbind. The next call to TestMethod2() then fails, because that relies on the static reference which at that point is again an unbound reference. In the current setup you also need to make sure your DataInitializerForBom class sticks in memory for the lifetime of the other classes, otherwise you will also see your dataset vanish at unexpected moments. To me it doesn't seem right for a helper to be the actual owner of the data; helpers should be able to disappear when they've performed their task. I'd suggest making the controlling class (in the example here that's the test harness) the owner of the actual dataset instance. (Well, in my opinion the dataset should be a stand-alone object, and the controller should instantiate dataset and logic and link them up as desired. But until the ABL starts exposing built-in objects via OO syntax, building things like that gets messy fast.) From there: - Make the helper accept that instance as BY-REFERENCE, call that to re-initialize (fill/empty etc.) the dataset as needed. - Between controller and BomLogic, use a BIND passing or use BY-REFERENCE on every method call to it. Which option you choose depends on how loose you want your coupling to be vs. perforamce trade-offs etc.

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