欢迎来到天天文库
浏览记录
ID:20486513
大小:413.79 KB
页数:139页
时间:2018-10-12
《第十二章 面向对象编程chapter12_object-oriented design》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、PythonProgramming,3/e1PythonProgramming:AnIntroductionToComputerScienceChapter12Object-OrientedDesignPythonProgramming,3/e2Tounderstandtheprocessofobject-orienteddesign.Tobeabletoreadandunderstandobject-orientedprograms.Tounderstandtheconceptsofencapsulation,polymorphismandinheritanceasthey
2、pertaintoobject-orienteddesignandprogramming.ObjectivesPythonProgramming,3/e3ObjectivesTobeabletodesignmoderatelycomplexsoftwareusingobject-orienteddesign.PythonProgramming,3/e4TheProcessofOODMostmoderncomputerapplicationsaredesignedusingadata-centeredviewofcomputingcalledobject-orienteddesig
3、n(OOD).TheessenceofOODisdescribingasystemintermsofmagicalblackboxesandtheirinterfaces.PythonProgramming,3/e5TheProcessofOODEachcomponentprovidesaserviceorsetofservicesthroughitsinterface.Othercomponentsareusersorclientsoftheservices.Aclientonlyneedstounderstandtheinterfaceofaservice–implement
4、ationdetailsarenotimportant;theymaybechangedandshouldn’taffecttheclientatall!PythonProgramming,3/e6TheProcessofOODThecomponentprovidingtheserviceshouldn’thavetoconsiderhowtheserviceisused–itjustneedstoprovidetheservice“asadvertised”viatheinterface.Thisseparationofconcernsmakesthedesignofcompl
5、exsystemspossible.PythonProgramming,3/e7TheProcessofOODIntop-downdesign,functionsservetheroleoftheblackbox.Clientprogramscanusethefunctionsaslongasitunderstandswhatthefunctiondoes.Howthefunctionaccomplishesitstaskisencapsulatedwithinthefunction.PythonProgramming,3/e8TheProcessofOODInOOD,thebl
6、ackboxesareobjects.Themagicbehindtheobjectsisintheclassdefinitions.Onceaclassdefinitioniswritten,wecanignorehowtheclassworksandrelyontheexternalinterface,itsmethods.You’veseenthiswhenusingthegraphicslibrary–youwereabletodrawacirclewithouthavingtoknowallthenitty-grittydetailsencapsulatedinclas
7、sdefinitionsforGraphWinandCircle.PythonProgramming,3/e9TheProcessofOODBreakingalargeproblemintoasetofcooperatingclassesreducesthecomplexitythatmustbeconsideredtounderstandanygivenpartoftheprogram.Eachclassstandsonitsown!OODistheprocessoffindi
此文档下载收益归作者所有