Corel Paradox:
Not Supported
Built-in: In ObjectPAL, polymorphism is the capability of the built-in objects to act differently depending on the context in which they are being used. For example, Table.Open and TCursor.Open. The Open method works differently depending on the object type used.
Custom: No. However, you can have the same named method or procedure so long as they are in different libraries. This is important if you use libraries in a class-like OOP way and wish to implement some form of interfaces-like polymorphism (i.e. libMember.GetName and libVendor.GetName).
More Info / Comment
Polymorphism A coding technique where the same named function, operator, or object behaves differently depending on outside input or influences. Usually implemented as parameter overloading where the same named function is overloaded with other versions that are called either with a different type or number of parameters. Polymorphism is a general coding technique and other specific implementations are common such as inheritance, operator overloading, and interfaces.
More Info
Abstract: Compromise Implementation strategies.
Although not as popular as it once was, Paradox is still one of the best desktop database applications for Windows and Linux. Many developers implement solutions using Paradox and ObjectPAL. The standard for building quality solutions is object oriented analysis, design, and programming. Paradox is not fully object oriented (OO), it is object based. A good tool doesn't have to be object oriented in order to be useful. However, if you develop database applications using object oriented analysis (OOA) and object oriented design (OOD) it is critical to understand how OO concepts relate to Paradox and to explore possible compromise implementation strategies. The purpose of this article is to introduce OO concepts to the Paradox community and to discuss techniques for implementing compromise implementation strategies.
What is Object Orientation (OO)?
OO was born out of the need to create better reusable code. Typical non-OO applications end up with a library of code that is not very well organized (if at all). For example, in Paradox you store your reusable code in libraries. During the coding of your application, when you find a custom method or custom procedure that you will call from two locations, you put the routine in a library. Perhaps you'll name the library the same name as the application or simply utils.lsl or misc.lsl. By the time you're done coding your application, you might have several libraries of reusable code. Coding on the fly like this is useful, but if you knew prior to coding what routines would be reusable, you could organize your code better. OO allows you to do this and much more.
What does it mean to be fully object oriented?
Sometimes developers talk about degrees of object orientation. For example, Visual Basic is object based just like Paradox. With version 6, Microsoft introduced a form of abstract single level inheritance. Many Visual Basic developers thought Visual Basic 6 was fully object oriented. Those that knew better knew that Visual Basic was one step closer, but still wasn't fully OO. When using object oriented analysis and design, Visual Basic developers have to compromise on the implementation (just like Paradox developers have to).
Note, Visual Basic.NET beta 2 does support true full inheritance.
Classes and Objects
A class is a set of similar objects and an object is an instance of a class. You can think of a class as the design of an object that will be created in your code. A helpful analogy to draw upon is the architectural drawings of a building and the building itself. You can think of the architectural drawing as the class and the building that is built as the instance of the object. Here are some helpful characteristics of classes and objects:
· Both classes and objects have identity. For example, you can have a MyCustomer object that is instantiated from a Customer class.
· A class defines attributes and methods. An object uses these attributes and methods.
· Because an object has the ability to set the attributes, objects are said to have state. The current state of an object is simply the current values of its attributes. Classes do not have state.
Each type in ObjectPAL and each tool on the Design toolbar is a class with attributes and methods. When you place a tool (for example a button tool) on a form, you create a button object from a button class. The class is the code that was instantiated to generate an instance of the button object.
Class Creation in ObjectPAL
Unfortunately you can't create classes in your code, but you can simulate classes using libraries. In Paradox, create one ObjectPAL library per design class.
Implementing methods and attributes:
- Class Methods - For the sake of this document, you can think of custom methods and custom procedures as methods.
- Class Attributes - In Paradox, you don't have true class attributes because you can't create a true class. The best you can do is to simulate an attribute with custom methods that set and return the value stored in a defined variable.
For example:
libCustomer.SetCustomerNumber() libEmployee.SetEmployeeNumber()
libCustomer.GetGustomerNumber() libEmployee.GetEmployeeNumber()
Inheritance
In object orientation you can declare a new class from an existing class. The new descendant class (also called a subclass or child class) has all the attributes and methods of...
More Info
|