Forum Post: Object instanciation and properties

Status
Not open for further replies.
G

Gabriel Hautclocq

Guest
Hello, I have performance issues with my ABL classes (Progress 10.2b). Are there some best practice tips for Object properties ? I try to use lazy instantiation on my properties to avoid infinite loops caused by circular references, but I think the properties are evaluated during the object instantiation, defeating the benefits of using lazy instantiation. Here is an example: DEFINE PRIVATE VARIABLE cl_enterprise AS NameSpace.Enterprise NO-UNDO. DEFINE PUBLIC PROPERTY pin_EntId AS INTEGER NO-UNDO GET. PRIVATE SET. DEFINE PUBLIC PROPERTY pcl_Enterprise AS NameSpace.Entreprise NO-UNDO GET(): IF NOT VALID-OBJECT( cl_enterprise ) AND pin_EntId 0 THEN DO : cl_enterprise = NEW NameSpace.Enterprise( pin_EntId ). END. RETURN cl_entreprise. END GET. PRIVATE SET( INPUT pr_cl_valeur AS NameSpace.Entreprise ): THIS-OBJECT:cl_enterprise = pr_cl_valeur. END SET. CONSTRUCTOR PUBLIC Contact( INPUT pr_in_EntId AS INTEGER ): SUPER(). ASSIGN pin_EntID = pr_in_EntId. END CONSTRUCTOR. I'm trying to instantiate the object cl_enterprise on first access. Am I doing something wrong ?

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