[OT] Inheritance In WebServices

Liza (archive)

Usenet Archive
Joined
Jun 23, 2003
Messages
28
Reaction score
0
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
 

Andy Dingley

Usenet Archive
Joined
Feb 23, 2000
Messages
3,303
Reaction score
0
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top