Best Practices - Aparent Class Property

The purpose of this document is to provide best practices to use the APARENT class property, which gives access to the instance referencing the class you are working on.

If a child class is used by different parent classes, refering to the parent class in the script associated with the child class can be risky. You could test this.APARENT.objecttype, but the code would still depend on the parent class evolution, making it unpredictable.

The general rule is the following: if the control or initialization of a property in a child instance does not depend on the parent, place the code at the child class level. Otherwise, place it at the parent class level.

Example:

Suppose you have an "ORDER" class, a "DELIVERY" class, and a "LINE" class.

The correct method for the script associated with the "ORDER" class is as follows:

$PROPERTIESCase CURPROWhen "LINES.DATELINE" : Gosub DATELINE...EndcaseReturn$DATELINECase ACTIONWhen "INIT" : Gosub INIT_DATELINE...EndcaseReturn$INIT_DATELINEthis.DATELINE=this.APARENT.DATEORDReturn

The correct method for the script associated with the "DELIVERY" class is as follows:

$PROPERTIESCase CURPROWhen "LINES.DATELINE" : Gosub DATELINE...EndcaseReturn$DATELINECase ACTIONWhen "INIT" : Gosub INIT_DATELINE...EndcaseReturn$INIT_DATELINEthis.DATELINE=this.APARENT.DATEDELReturn