OO dynamic inheritance - Forum - OpenEdge Development - Progress Community
 Forum

OO dynamic inheritance

This question is answered

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

Verified Answer
  • 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
  • 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.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • 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!

  • 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
     
    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.

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

  • 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
     
    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.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Things I learned today: you can create a System.Object class on Linux :) #DontTryThisAtHome
     
    -- peter
     
    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
     
    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.

  • 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
     
    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
     
    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.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Er, not so much …
     
    class System.Object:
      define public property Foo as char get. set.
    end class.
     
    -- peter
     
     
    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
     
    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
     
    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.

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

  • 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


    Simon L Prinsloo

    www.vidisolve.com

  • 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.

  • 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!

  • 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 ...

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • Richard.Kelters

    It seems OO was not meant for dynamic inhertance.

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