inheritance is very powerful tool for extending behavior it is also one of the most marketable advancements of object-oriented design over earlier paradigms thereforeit is often the first tool that object-oriented programmers reach for howeverit is important to recognize that owning hammer does not turn screws into nails inheritance is the perfect solution for obvious is relationshipsbut it can be abused programmers often use inheritance to share code between two kinds of objects that are only distantly relatedwith no is relationship in sight while this is not necessarily bad designit is terrific opportunity to ask just why they decided to design it that wayand whether different relationship or design pattern would have been more suitable case study let' tie all our new object-oriented knowledge together by going through few iterations of object-oriented design on somewhat real-world example the system we'll be modeling is library catalog libraries have been tracking their inventory for centuriesoriginally using card catalogsand more recentlyelectronic inventories modern libraries have web-based catalogs that we can query from our homes let' start with an analysis the local librarian has asked us to write new card catalog program because their ancient dos-based program is ugly and out of date that doesn' give us much detailbut before we start asking for more informationlet' consider what we already know about library catalogs catalogs contain lists of books people search them to find books on certain subjectswith specific titlesor by particular author books can be uniquely identified by an international standard book number (isbneach book has dewey decimal system (ddsnumber assigned to help find it on particular shelf this simple analysis tells us some of the obvious objects in the system we quickly identify book as the most important objectwith several attributes already mentionedsuch as authortitlesubjectisbnand dds numberand catalog as sort of manager for books we also notice few other objects that may or may not need to be modeled in the system for cataloging purposesall we need to search book by author is an author_ name attribute on the book howeverauthors are also objectsand we might want to store some other data about the author as we ponder thiswe might remember that some books have multiple authors suddenlythe idea of having single author_name attribute on objects seems bit silly list of authors associated with each book is clearly better idea