INHERITANCE
To make it easier to deploy general features, I wanted to create template forms that I could expand upon. Essentially, the exact same way Inheritance works in Object Oriented Programming.
Inheritance allows you to create class hierarchies, where a base class gives its behavior and attributes to a derived class. You are then free to modify or extend its functionality.
By creating my ‘class’ form, I want to derive this class into a new form. Then, modify different aspects so it’s a unique object. These changes would be both Frontend and Backend. This would mean all these would share a similar element, making it easy to add a new feature to everything, but also to have unique code and elements for every page.
EXTENDFORM
I looked into if Servoy can do this. There seems to be an ‘extendForm’ feature, but I’m confused on how to use it. I found this wiki talking about an ‘Inheritance Model’;
This is from Servoy 7. It talks about extending a form. But also, ‘Overwrite Methods’. Overriding the existing code in the class. Which seems to be by calling the ‘superform’. This is by calling the super with ‘_super’.
CURRENT?
This guide was from Servoy 7, but I’m not sure if this process has changed it all in the current version of Servoy. Is it OK to still use this? Or is it being deprecated or changed in Titanium.
Also is there a guide on how to use it now if has been updated?
some comment on using functions from the parent form:
As long as functions (methods) have been tagged with @public or @protected, you will be able to choose these from a child form.
In case you want to extend code on the child form, you just create a function with the same name.
Within that function you can call _super.myFunction to call functions on the parent form.
some comment on using functions from the parent form:
As long as functions (methods) have been tagged with @public or @protected, you will be able to choose these from a child form.
In case you want to extend code on the child form, you just create a function with the same name.
Within that function you can call _super.myFunction to call functions on the parent form.
Hope this helps a bit more
Alrighty! Thanks!
And just to be clear, this feature isn’t being removed any time soon right? If I convert my whole project into using this, it won’t all disappear in Titanium, correct? Just making sure before I start applying this everywhere.
mboegem:
And just to be clear, this feature isn’t being removed any time soon right? If I convert my whole project into using this, it won’t all disappear in Titanium, correct? Just making sure before I start applying this everywhere.
Well, this answer is up to Servoy.
Titanium is “no more” than current NG on Angular (instead of AngularJS)
I’d expect most applications to break if this would be discontinued and I don’t see why it should be.
Considering everything I know, I wouldn’t hesitate to use it.