OO dynamic inheritance

Posted by Richard.Kelters on 25-Mar-2015 13:50

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Posted by bronco on 25-Mar-2015 15:00

Create one class (say: ClassA) which contains all the logic. Let the class (ClassNet) which must inherit System.Object have a private variable to hold a reference to ClassA. Instantiate ClassA in the constructor of ClassNet. Create stub method in ClassA which are wired to the same method in (the instance of) ClassA. Don't use includes, it *will* bite you somewhere later on!

All Replies

Posted by Mike Fechner on 25-Mar-2015 14:00
Conditional compilation?

Von meinem Windows Phone gesendet

Von: Richard.Kelters
Gesendet: ‎25.‎03.‎2015 18:51
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] OO dynamic inheritance

Thread created by Richard.Kelters

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by bronco on 25-Mar-2015 15:00

Create one class (say: ClassA) which contains all the logic. Let the class (ClassNet) which must inherit System.Object have a private variable to hold a reference to ClassA. Instantiate ClassA in the constructor of ClassNet. Create stub method in ClassA which are wired to the same method in (the instance of) ClassA. Don't use includes, it *will* bite you somewhere later on!

Posted by Peter Judge on 25-Mar-2015 15:01
Create two of your own TagWrapper classes, one which uses System.Object and one which doesn't. Ship to appropriate platforms.
 
Alternatively, can you create a class called System.Object in ABL on Linux?
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 15:01
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: OO dynamic inheritance
 
Reply by Mike Fechner
Conditional compilation?

Von meinem Windows Phone gesendet

Von: Richard.Kelters
Gesendet: ‎25.‎03.‎2015 18:51
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] OO dynamic inheritance
Thread created by Richard.Kelters

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]
Posted by bronco on 25-Mar-2015 15:02

nice quote in this case: "try to solve it with decoration, not inheritance".

Posted by Mike Fechner on 25-Mar-2015 15:07
Peter, shame on you!

Von meinem Windows Phone gesendet

Von: Peter Judge
Gesendet: ‎25.‎03.‎2015 20:02
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] AW: OO dynamic inheritance

Reply by Peter Judge
Create two of your own TagWrapper classes, one which uses System.Object and one which doesn't. Ship to appropriate platforms.
 
Alternatively, can you create a class called System.Object in ABL on Linux?
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 15:01
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: OO dynamic inheritance
 
Reply by Mike Fechner
Conditional compilation?

Von meinem Windows Phone gesendet
[collapse]
Von: Richard.Kelters
Gesendet: ‎25.‎03.‎2015 18:51
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] OO dynamic inheritance
Thread created by Richard.Kelters

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse][/collapse]
Posted by Peter Judge on 25-Mar-2015 15:56
Things I learned today: you can create a System.Object class on Linux :) #DontTryThisAtHome
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 16:08
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: AW: OO dynamic inheritance
 
Reply by Mike Fechner
Peter, shame on you!

Von meinem Windows Phone gesendet

Von: Peter Judge
Gesendet: ‎25.‎03.‎2015 20:02
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] AW: OO dynamic inheritance
Reply by Peter Judge
Create two of your own TagWrapper classes, one which uses System.Object and one which doesn't. Ship to appropriate platforms.
 
Alternatively, can you create a class called System.Object in ABL on Linux?
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 15:01
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: OO dynamic inheritance
 
Reply by Mike Fechner
Conditional compilation?

Von meinem Windows Phone gesendet

Von: Richard.Kelters
Gesendet: ‎25.‎03.‎2015 18:51
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] OO dynamic inheritance
Thread created by Richard.Kelters

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse][/collapse]
Posted by Mike Fechner on 25-Mar-2015 15:58
You tried the Mono framework? ;-)

Von meinem Windows Phone gesendet

Von: Peter Judge
Gesendet: ‎25.‎03.‎2015 20:56
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] AW: AW: OO dynamic inheritance

Reply by Peter Judge
Things I learned today: you can create a System.Object class on Linux :) #DontTryThisAtHome
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 16:08
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: AW: OO dynamic inheritance
 
Reply by Mike Fechner
Peter, shame on you!

Von meinem Windows Phone gesendet
[collapse]
Von: Peter Judge
Gesendet: ‎25.‎03.‎2015 20:02
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] AW: OO dynamic inheritance
Reply by Peter Judge
Create two of your own TagWrapper classes, one which uses System.Object and one which doesn't. Ship to appropriate platforms.
 
Alternatively, can you create a class called System.Object in ABL on Linux?
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 15:01
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: OO dynamic inheritance
 
Reply by Mike Fechner
Conditional compilation?

Von meinem Windows Phone gesendet
[collapse]
Von: Richard.Kelters
Gesendet: ‎25.‎03.‎2015 18:51
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] OO dynamic inheritance
Thread created by Richard.Kelters

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse][/collapse][/collapse][/collapse]
Posted by Peter Judge on 25-Mar-2015 16:01
Er, not so much …
 
class System.Object:
  define public property Foo as char get. set.
end class.
 
-- peter
 
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 16:59
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: AW: AW: OO dynamic inheritance
 
Reply by Mike Fechner
You tried the Mono framework? ;-)

Von meinem Windows Phone gesendet

Von: Peter Judge
Gesendet: ‎25.‎03.‎2015 20:56
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] AW: AW: OO dynamic inheritance
Reply by Peter Judge
Things I learned today: you can create a System.Object class on Linux :) #DontTryThisAtHome
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 16:08
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: AW: OO dynamic inheritance
 
Reply by Mike Fechner
Peter, shame on you!

Von meinem Windows Phone gesendet

Von: Peter Judge
Gesendet: ‎25.‎03.‎2015 20:02
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] AW: OO dynamic inheritance
Reply by Peter Judge
Create two of your own TagWrapper classes, one which uses System.Object and one which doesn't. Ship to appropriate platforms.
 
Alternatively, can you create a class called System.Object in ABL on Linux?
 
-- peter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Wednesday, 25 March, 2015 15:01
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: OO dynamic inheritance
 
Reply by Mike Fechner
Conditional compilation?

Von meinem Windows Phone gesendet

Von: Richard.Kelters
Gesendet: ‎25.‎03.‎2015 18:51
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] OO dynamic inheritance
Thread created by Richard.Kelters

Hi,

We're using a class that inherits System.Object in order to assign it to the Tag property of a .NET control. We'd like to use that class also on our appserver which runs Linux.

Is there another way then define two classes one with and the other without inherits System.Object and put all the code in an include?

Richard

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse][/collapse][/collapse]
Posted by bronco on 26-Mar-2015 02:04

Create your own System.Object for Linux. Well, because you can doesn't mean you should ;-)

Posted by Simon L. Prinsloo on 26-Mar-2015 02:29
Richard

I got around that by creating a standard object (no .Net). On the client side, I derived a new object from that one, on which I implemented a .Net interface with no members. Once you cast it to the .Net interface, you can assign it to the tag.

The limitation here is that you need your own serialization if you need to cross the AppServer boundary.

Regards
Simon


Posted by Richard.Kelters on 26-Mar-2015 06:08

Simon,

.NET interface with no members, like System.Web.SessionState.IRequiresSessionState?

I don't understand your suggestion, could you provide an example?

We're not interested in serialization but I would like to compile my app on windows and run it on both platforms with the same .pl without any config changes.

Richard

@Mike, Bronco and Peter I'm to lazy to either change our compile routine or duplicatie a bunch of properties and methods in a wrapper or change our deployment for changes between windows and Linux.

Posted by Richard.Kelters on 03-Apr-2015 13:07

It seems OO was not meant for dynamic inhertance.

I solved my problem by introducing an empty class that inherits sytem.object with just a property that holds the handle to 'my' class.

Thanks!

Posted by Thomas Mercer-Hursh on 03-Apr-2015 13:31

It seems OO was not meant for dynamic inhertance.

There are those who would say there is a reason for that. :)

The whole idea of ancestors who may or not be there is rather not the way that one thinks about classes in OO.  While I understand your dilemma, there are those who would say that it must mean that you had partitioned the problem space incorrectly or the issue would not arise.

Just saying ...

Posted by Marian Edu on 05-Apr-2015 05:58

[quote user="Richard.Kelters"]

It seems OO was not meant for dynamic inhertance.

[/quote]

javascript prototype can do that, classical inheritance not... be it for a good reason or not :)

This thread is closed