[OT] Inheritance In WebServices

Discussion in 'XML' started by Liza, Aug 19, 2003.

  1. Liza

    Liza Guest

    can anyone tell me ......


    if i have 2 classes in my class diagram.....InboundFILght and
    OutboundFlight .........and the only difference between the 2 is that
    there is resctriction on the choice of departure and destination
    airports for each (althought they have exactly the same set of
    attributes and methods). can i consider these 2 classes for
    inheritance and WHY ??



    thank you.


    Liza
     
    Liza, Aug 19, 2003
    #1
    1. Advertising

  2. Liza

    Andy Dingley Guest

    On 19 Aug 2003 11:41:43 -0700, (Liza) wrote:

    >if i have 2 classes in my class diagram.....InboundFILght and
    >OutboundFlight [...] can i consider these 2 classes for
    >inheritance and WHY ??


    Inherit both from an abstract absFlight class.


    This is _not_ an XML, nor a web services question. Talk of
    "inheritance" is a matter for 1980's vintage OO programming style
    (read Bertrand Meyer's Eiffel book "Object-oriented Software
    Construction"). Although it's a reasonable technique for this sort of
    coding, it'll cause problems if you start thinking of inheritance too
    much when you architect a web service.

    Compare "old" OO languages to "modern" OO langauges like Java and
    (yes, indeed) VB. There's a shift from the "inheritance" model to the
    "interface" model. Inheritance isn't a bad model for structuring the
    code internally, but it's a poor model for building the external call
    interface. The need to support multiple external use-cases means that
    you need to bring multiple external interfaces together. Doing this
    through multiple inheritance (early C++ practice) soon showed up how
    horrible MI could become.

    So these days we build interfaces separately to implementation, and we
    no longer tie these interfaces to our inheritance. Re-introducing this
    coupling to a web services interface (by getting over-focussed on the
    inheritance of *Flight classes) would definitley be a bad thing.

    There are interfaces (ShowMeThePilot, IgniteShoeBomb) that apply to
    both classes. There are interfaces (PredictArrivalTime) that only
    apply to one. Build these separately, allow them to apply to
    approriate classes, but don't start fiddling with the inheritance. For
    instance you might also implement the
    AirportShuttleBus::predictArrivalTime interface, but you shouldn't
    start inheriting both classes of absFlight and Bus from an invented
    ancestor of absTimetabledTransportVehicle.
     
    Andy Dingley, Aug 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. maxw_cc
    Replies:
    1
    Views:
    3,159
    Martijn van Steenbergen
    Dec 21, 2003
  2. cppsks
    Replies:
    0
    Views:
    833
    cppsks
    Oct 27, 2004
  3. karthikbalaguru
    Replies:
    9
    Views:
    1,053
  4. Daniel Pitts
    Replies:
    27
    Views:
    1,924
    Mike Schilling
    Feb 27, 2008
  5. johnsonlau
    Replies:
    1
    Views:
    783
    Kai-Uwe Bux
    Jul 21, 2008
Loading...

Share This Page