PRPC OOP Terms: Methods
Methods are functions whose behavior is tied to a specific class. The intimacy of a method to its class allows extraordinary control over the state of objects derived from the class but also limits the behavior relative to other objects. This restraint assists developers in managing boundaries between objects and the classes that define them. Below are three special purpose method types with which you should be familiar.
Abstract method is a function whose behavior is appropriate to any objects derived from subclasses of an Abstract Base Class.
An abstract method is implemented as an activity (or other action-oriented rule type) whose "applies to" name part is a PRPC abstract class. It will generally operate only against properties defined within the abstract class and allow specialization of large portions of functionality by making frequent calls to Virtual methods (see below).
Virtual method is a function whose behavior, by virtue of being considered "virtual," is determined by the definition of a function with the same signature furthest down in the inheritance lineage of the instantiated object on which it is called. By convention, virtual methods are typically implemented within Abstract Base Classes. This concept is a very important part of the polymorphism portion of object-oriented programming (OOP).
A Virtual method is implemented by creating a "stub" or Activity with no steps (or other rule type) in a parent class and a like-named, overriding method Activity in a subclass with steps defined. An activity intended to use the method against a subclass Instance at run-time will call the virtual method using a Step Page whose class is defined as being of the (usually Abstract) parent class. At compile-time, access is validated against the Virtual method (Activity) and at run-time the overriding method (Activity) is executed.
Static methods act at the class level rather than at the instance level. Therefore, a static method cannot refer to a specific instance of the class. They may be found in both concrete and abstract classes.
A static method is implemented as an Activity that does not operate on its Primary page. Any internal functionality will use pages explicitly created via Page-New, Obj-Open, etc.. It may therefore be invoked without an appropriately instantiated page using a Call <class name>.<static activity name> syntax with an empty Step Page.
Labels: Public
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home