Java Reference
In-Depth Information
corporatesallthefeaturesofitsparentclass,andmayaddsomeunique
featuresofitsown.Derivedclasseshaveaccesstoallthepublicmembers
oftheirbaseclass.
Parent
,
child
,and
sibling
aretermssometimesused
toexpressdegreesofinheritancebetweenclasses.Asinbiologicalsys-
tems,siblingclassesdonotinheritfromeachother.Therefore,theprop-
ertiesofFISH(in
Figure14-1
)
arenotinheritedbyitssiblingclass,BIRD.
Thisruleisalsoappliedinobject-orientedclassinheritance.
Modeling with Classes
Softwaresystemsarecomplex,andobject-orientedsoftwaredevelopment
oftenresultsincomplicatedstructuresofrelatedandunrelatedclassesand
subclasses.Inordertounderstandcomplexsystemsyoucanuseamodel
thatsimplifiesit.Architectscreatescalemodelsofabuildingthatcanbe
showntoclients.Anengineerdrawsamodelofamechanicalcomponent
thatislaterusedtomanufacturethepart.Anaircraftdesignercreatesa
modelofanairplanethatcanbetestedinawindtunnel.Themoreelaborate
orcomplexasystemthemoreusefulthemodel.
Inobject-orientedsoftwaresystems,classesandobjectsinheritprop-
ertiesfromtheirparentsandinteractwiththeirsiblings.Systemdesign-
ersworkatahighlevelofabstractionandusemodelsthatshowthe
interactionbetweenthecomponentelements.Severalsuccessfulmodel-
ingtoolshavebeendevelopedovertheyears.Thebasicelementofall
thesemodelingtoolsisanotationforclassesandobjectsandtheirrela-
tions.OneofthemostpopularmodelsisduetoCoadandYourdon.
Booch,Jacobson,andRumbaughcreatedtheUnifiedModelingLanguage
(UML)thatusesanotationsimilartotheoneproposedbyCoadand
Yourdon.Ineithernotations,CoadandYourdonandUML,rectangular
boxesareusedtodenoteclassesandseveralconnectorsrepresentclass'
associationsandrelationships.InthisbookweusetheCoadandYourdon
notation,sinceitisthesimplestone.Attimes,weintroduceminorvaria-
tionstotheCoadandYourdonmodel.
Figure14-2
showsthediagramofa
class.
ClassName
Attributes
Methods()
Figure 14-2
A Class Diagram