Rooting around in the Forum: destructors
Bob Sneidar
bobsneidar at iotecdigital.com
Mon Jun 5 11:36:09 EDT 2017
OOP is driven by the concept of classes and objects, and you cannot think that only means buttons and fields, user interface objects only. OOP means something quite different. Every thing you can refer to in an OOP environment MUST have a parent class. That is what I mean by, "driven".
A Class is a definition for an object, a template if you will. You can create a hierarchical system of root classes and child classes that inherit some (or all) of the parent class properties. In fact if you expect to get very far, you *MUST* create that hierarchy before you do any coding.
To create an object, you create an instance of a class. In an LC sense it would be like being able to create multiple templates of buttons, fields and menus that looked and acted differently, even for one off objects, and then create instances of them in such a way that if you edited a property of the parent class, say the textfont, all the children/instances of that class would also change. That is the magic of inheritance. But it means that you have to spend an inordinate amount of time planning and structuring you application before you begin creating any of it. Great care to follow good practices is necessary if you intend to go back and modify your class structure.
Livecode has no class paradigm per se. You simply create copies of objects that have no backwards inheritance to the "parent" object or class. Indeed there is no parent. LC objects are orphans at birth.
I have often though that it might be nice to create an OOP system from the scripting side, but the more I thought about it, the more complex I saw it would have to be. In the end it would be like building the foundation of a tower on top of the tower after the tower had already been built.
Bob S
> On Jun 3, 2017, at 12:05 , Richmond Mathewson via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Thanks for the explanation: although, to be honest I've never really quite worked out what the
> difference is between Object-oriented languages and Object-based languages (I know that LiveCode is object-based).
More information about the use-livecode
mailing list