Skip to content

Design Considerations

As their declaration suggests, Procedures and Functions are global (i.e., they can be called anywhere within the program).

In a carefully designed object-oriented program, there is very little need to declare and use global procedures since each class should declare its own set of methods to perform all necessary operations.

Global functions are more useful since they could be viewed as an extension to DataFlex's built-in function library.

However, it should be remembered that any new global procedure or function you write that is used by a class will break that class's encapsulation. One consequence of breaking encapsulation is that it complicates the re-use of the class in other programs (a key benefit of object-oriented programming). The reason this occurs is that the class definition now contains an outside dependency upon any global functions that it uses. Its use is therefore dependent upon the existence of these functions.