Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > [OT] Inheritance In WebServices

Thread Tools

[OT] Inheritance In WebServices

Posts: n/a
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.

Reply With Quote
Andy Dingley
Posts: n/a
On 19 Aug 2003 11:41:43 -0700, Removed) (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:redictArrivalTime interface, but you shouldn't
start inheriting both classes of absFlight and Bus from an invented
ancestor of absTimetabledTransportVehicle.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Struct inheritance against class inheritance johnsonlau C++ 1 07-21-2008 04:58 PM
Interface inheritance vs Implementation inheritance. Daniel Pitts Java 27 02-27-2008 01:37 AM
Private Inheritance and Publice Inheritance karthikbalaguru C++ 9 09-10-2007 01:05 PM
mul. inheritance & overloading operator new/delete solved by virtual base inheritance? cppsks C++ 0 10-27-2004 07:49 PM
Private access modifier and Inheritance (Inheritance implementation in Java) maxw_cc Java 1 12-21-2003 11:38 AM