• The benefit of hindsight

    From pete dashwood@dashwood@enternet.co.nz to comp.lang.cobol on Mon Sep 10 14:03:14 2018
    From Newsgroup: comp.lang.cobol

    We've just finished a big effort to enable third party controls used on PowerCOBOL sheets, to be executed with identical functionality under
    WinForms.

    I thought this would be pretty easy; I was wrong...

    I SHOULD have been able to pass-thru the parameter list from a method
    being invoked under PowerCOBOL, and, provided the same third party
    Control (TPC) was installed on the VS design surface for the new
    WinForm, the results SHOULD be the same.

    However, it turned out to be much more complex than that.

    With a TPC at run time we are trying to manipulate unknown attributes
    and methods in an unknown control. (I am reminded of something about a
    blind man looking in a darkroom for a black cat... that isn't there...)

    Fortunately, C# provides Reflection, which lets you say to a control
    (once you have an instance of it): "Tell me about your attributes and methods..." and it does.

    Then you can say: "So for this Method, what parameters do I need?" And
    again Reflection returns them. It also can provide information about the
    types of each parameter and it is all very interesting and powerful, but
    it is a bit headspinning if you work too long at a stretch on it...

    Anyway, I finally got it all working and was chatting to the client.

    "Why did you use a non-standard Tool Bar and a non-standard grid in the
    first place?"

    "Well they offered a bit more than the standard PowerCOBOL ones and it
    seemed a good idea at the time."

    "You know that eventually you'll have to replace these TPCs with
    standard WinForms controls?"

    "Yes. But the WinForms controls are much more powerful..."

    "True. But if you HADN'T gone to a non-standard solution back in the
    day, the PC2N tool would have written all the code for us when we moved
    from the PowerCOBOL control to the WinForms one..."

    In the ensuing quiet I offered...

    "Never mind. The TPC pass-thru is solved and it will buy us a few years
    to get everything migrated and stable. Then we can look at replacing the TPCs..."

    Sometimes, we see a facility in a TPC that looks like just what we
    want/need. Sometimes the decision to buy it can come back some years
    later to bite us on the bum...

    Pete.
    --
    I used to write COBOL; now I can do anything...
    --- Synchronet 3.20a-Linux NewsLink 1.114