Replace conditional statement with Polymorphism
doug at artsman.com
Sun Jul 3 15:06:06 UTC 2022
a number of helpful listers focused on the actual algorithm.
to give you some sort of isolation and put that function in one spot, so you can easily fix it.
I’d create a method in your report superclass with parameter ‘pColLength’. let call it $getPixel
then you can call it anywhere, in any report…. with the data in one spot
ever report would have the same function, since its in a superclass, giving you a single place for the code.
and, should you want to over ride it in any one report, you can over ride that function to have one report do it differently.
thats how I’d structure the code.
as for the actual algorithm…. lots of ideas there.
Arts Management Systems Ltd.
mailto:doug at artsman.com
Phone (403) 650-1978
> On Jul 1, 2022, at 11:45 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> Hi Listers,
> I have an academic question about object-oriented programming.How is "polymorphism" implemented in Omnis Studio?
> I have many conditional statements in my code: if...else if, switch...case that keeps breaking whenever I make a change in a related method elsewhere.Is there a sample library in the HUB which best described how to work with code that can take many forms?
> Kind regards,Martin O.
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en