Two very useful OOP-style features
Posted: Thu Apr 23, 2015 5:18 pm
I'd like to suggest two OOP features that would greatly enhance the ability to create functionality, and organize and reuse code in LC. (I cringe every time I have to copy and paste identical code for lack of an easier way to reuse it.)
First, would be the addition of independent scripting objects, or scripts that can be created and instanced independently of a control, stack or card. In other words, an independent scripting window and scripts that are fully featured and functional objects in and of themselves, able to contain custom properties, and execute their own handlers. These scripting objects could be instanced in a global variable for a custom-class-like functionality, instance other objects , passing parameters and receiving data returned from them, affect the properties of other objects; or they could be instanced in a more localized, time-limited context for a more efficient implementation of all kinds of functionality.
Closely related to independent scripting objects would be the expansion of the current shared behaviors feature to include the attaching and execution of multiple behaviors. This would involve expanding the current single-behavior name field to a list that could contain any number of behaviors to be executed in sequence. While sharing the behavior of a single button is useful, having a library of independent, reusable, behavior scripts that could be attached to any button or control would be HUGE.
A forum search reveals that OOP has appeared as a feature request before, but I thought it may be a good time to revisit it, as the roadmap currently lists only two queued projects (physics and Win8).
I know many long-time LC'ers may never have used OOP in other languages, and have learned to do things in a procedural way, so they don't miss it. However, once having OPP capability, it is really hard to go back, as it is so much easier to create functionality, and organize and reuse code. This makes all aspects of an app's lifecycle easier to manage.
I'm curious how many LC developers would like to see OOP added to LC?
First, would be the addition of independent scripting objects, or scripts that can be created and instanced independently of a control, stack or card. In other words, an independent scripting window and scripts that are fully featured and functional objects in and of themselves, able to contain custom properties, and execute their own handlers. These scripting objects could be instanced in a global variable for a custom-class-like functionality, instance other objects , passing parameters and receiving data returned from them, affect the properties of other objects; or they could be instanced in a more localized, time-limited context for a more efficient implementation of all kinds of functionality.
Closely related to independent scripting objects would be the expansion of the current shared behaviors feature to include the attaching and execution of multiple behaviors. This would involve expanding the current single-behavior name field to a list that could contain any number of behaviors to be executed in sequence. While sharing the behavior of a single button is useful, having a library of independent, reusable, behavior scripts that could be attached to any button or control would be HUGE.
A forum search reveals that OOP has appeared as a feature request before, but I thought it may be a good time to revisit it, as the roadmap currently lists only two queued projects (physics and Win8).
I know many long-time LC'ers may never have used OOP in other languages, and have learned to do things in a procedural way, so they don't miss it. However, once having OPP capability, it is really hard to go back, as it is so much easier to create functionality, and organize and reuse code. This makes all aspects of an app's lifecycle easier to manage.
I'm curious how many LC developers would like to see OOP added to LC?