We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Subclassing, Composition, Python, and You

00:00

Formal Metadata

Title
Subclassing, Composition, Python, and You
Title of Series
Number of Parts
141
Author
License
CC Attribution - NonCommercial - ShareAlike 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Ever seen a code base where understanding a simple method meant jumping through tangled class hierarchies? We all have! And while "Favor composition over inheritance!" is almost as old as object-oriented programming, strictly avoiding all types of subclassing leads to verbose, un-Pythonic code. So, what to do? The discussion on composition vs. inheritance is so frustrating because far-reaching design decisions like this can only be made with the ecosystem in mind – and because there's more than one type of subclassing! Let's take a dogma-free stroll through the types of subclassing through a Pythonic lens and untangle some patterns and trade-offs together. By the end, you'll be more confident in deciding when subclassing will make your code more Pythonic and when composition will improve its clarity.
Food energyDirection (geometry)CodeLevel (video gaming)Right angleAttribute grammarUniform resource locatorSocial classSoftware testingDifferent (Kate Ryan album)Module (mathematics)CASE <Informatik>Java appletSoftwareHierarchyCoefficient of determinationGame controllerFormal languageInstance (computer science)Default (computer science)Run time (program lifecycle phase)Functional (mathematics)BitImperative programmingInheritance (object-oriented programming)Library (computing)ReliefSoftware developerDecision theoryMultiplication signObject-oriented programmingDrag (physics)Error messageCodeUnit testingData miningObject (grammar)Point (geometry)Encapsulation (object-oriented programming)Reading (process)Real numberStandard deviationProgrammer (hardware)Thread (computing)EmailPattern languageConnected spaceWritingMathematicsTemplate (C++)Dynamical systemParameter (computer programming)Computer animationLecture/ConferenceEngineering drawingDiagramProgram flowchartXML
Computer programDataflowArchitectureSoftware testingTime domainEvent horizonService (economics)CodeActive contour modelWeb pageInheritance (object-oriented programming)Data storage deviceVideo gameWeb serviceDataflowSocial classAbstractionAsynchronous Transfer ModeBoolean algebraDatabaseCodeImplementationComputer fileTrailInterface (computing)System callHoaxClassical physicsElectronic mailing listRepository (publishing)Product (business)Cartesian coordinate systemObject (grammar)Software maintenanceTemplate (C++)MereologyBookmark (World Wide Web)Image resolutionInteractive televisionHierarchyDemosceneComputer programmingAbstract data typePattern languageMobile appOrder (biology)Complex (psychology)1 (number)Dimensional analysisRhombusFormal verificationRule of inferenceOptical disc driveOverhead (computing)Object-relational mappingSet (mathematics)BitMultiplication signSound effectControl flowCASE <Informatik>Execution unitLevel (video gaming)Computer animationXMLLecture/Conference
Product (business)Inheritance (object-oriented programming)Set (mathematics)CASE <Informatik>Type theorySkewnessAbstractionDemosceneSocial classRepository (publishing)HierarchyTraffic reportingLevel (video gaming)Attribute grammarProduct (business)String (computer science)Mechanism designSet (mathematics)CodeDirection (geometry)TrailCoefficient of determinationMereologyRegular graphDynamical systemException handlingFunction (mathematics)Interface (computing)Instance (computer science)Run time (program lifecycle phase)Data storage deviceLogicInheritance (object-oriented programming)Communications protocolElectronic signatureModule (mathematics)Moment (mathematics)NumberComputer configurationOverhead (computing)Multiplication signGoodness of fitFormal languageSoftware repositoryComputer animation
Product (business)Repository (publishing)Set (mathematics)Strategy gameSatelliteNamespacePauli exclusion principleFood energyField (computer science)Subject indexingGame controllerEndliche ModelltheorieCASE <Informatik>NamespaceComputer fontEncapsulation (object-oriented programming)Total S.A.Control flowSocial classRight angleTheory of everythingSurfaceInstance (computer science)Attribute grammarSubstitute goodElectronic mailing listComplex (psychology)SurgeryError messagePoint (geometry)Software repositoryFluid staticsMultiplication signCodeData structureComputer simulationWordLevel (video gaming)SynchronizationHierarchyMathematicsModule (mathematics)TrailBitRun time (program lifecycle phase)Line (geometry)Communications protocolSoftware testingInterface (computing)Overhead (computing)Object-relational mappingSlide ruleType theoryHypothesisComputer architecturePatch (Unix)Pauli exclusion principleObject (grammar)Default (computer science)Goodness of fitFunktionalgleichungInheritance (object-oriented programming)Pattern languageImplementationStrategy gameSoftwareRepository (publishing)NP-hardFunctional (mathematics)Hand fanLibrary (computing)Field (computer science)RhombusBuffer overflowRule of inferencePower (physics)Core dumpComputer animationXMLLecture/Conference
Table (information)Meta elementFood energyAxiom of choiceObject (grammar)Price indexCategory of beingData modelReduction of orderSicComputer programComputerLibrary (computing)Client (computing)Computer programmingSoftware maintenanceException handlingError messageAttribute grammarMultiplication signSocial classScripting languageSoftware testingFunctional (mathematics)Object (grammar)Web pagePolymorphism (materials science)Endliche ModelltheorieSystem callCategory of beingComputer programmingSoftware bugNamespaceProjective planeCore dumpRight angleDecision theoryNumberComputer chessStructural loadDependent and independent variablesComputer architecturePerspective (visual)LogicSoftware engineeringInformationOpen sourceInheritance (object-oriented programming)Electric generatorKey (cryptography)Repository (publishing)Control flowJava appletCodeEncapsulation (object-oriented programming)Term (mathematics)Loop (music)Regular graphStatement (computer science)WritingHierarchySoftwareObject-relational mappingGame controllerTouch typingAddress spaceComputer animationXML
Type theoryInheritance (object-oriented programming)Formal languageBitMechanism designMeta elementGame controllerObject-relational mappingSocial classRule of inferenceComputer animationXMLUML
Exception handlingError messageResultantOntologySocial classPosition operatorMeta elementHierarchyCodeException handlingThumbnailDefault (computer science)MultiplicationConstraint (mathematics)Projective planeRhombusShared memoryXMLUMLComputer animation
RectangleCodeSubstitute goodClassical physicsMereologyLatent heatDesign by contractSquare numberObject-oriented programmingElectronic mailing listXMLUML
EmailAddress spaceString (computer science)Meta elementTelephone number mappingSocial classParameter (computer programming)CodeDatabaseTemplate (C++)Address spaceMereologyPoint (geometry)HorizonSocial classLink (knot theory)Multiplication signPasswordRight angleSpeech synthesisHierarchyEinbettung <Mathematik>Data structureDirection (geometry)Decision theoryPattern languageFlagShape (magazine)Clique-widthAbstractionLine (geometry)Domain nameSource codeHypermediaException handlingHand fanObject (grammar)WritingEmailSet (mathematics)Musical ensembleStrategy gameWebsiteHash functionType theoryDrag (physics)GodTable (information)Rule of inferenceCASE <Informatik>Field (computer science)Shared memorySubsetBitEndliche ModelltheorieDesign by contractFluid staticsElectronic mailing listFocus (optics)WordBlogQR codeComplexity classDot productComplex (psychology)Error messageComputer animationLecture/ConferenceXML
Coma BerenicesRoundness (object)Scheduling (computing)Lecture/ConferenceComputer animation
Transcript: English(auto-generated)