Author Dusty Phillips Reviewers



Download 2,95 Mb.
Pdf ko'rish
bet35/183
Sana20.07.2022
Hajmi2,95 Mb.
#831085
1   ...   31   32   33   34   35   36   37   38   ...   183
Bog'liq
python3-oop

Authors
or 
Actors

We can alleviate this by adding a 
GetContributors
method on the 
LibraryItem
class 
that subclasses can override. Then the catalog never has to know what attributes the 
objects are querying; we've abstracted the public interface:
+Title
+UPC
+Subject
+Contributors
Catalog
Book
DVD
Magazine
CD
Contributor
LibraryItem
+Search()
+ISBN
+Title
+Subject
+DDS number
+Authors
+Locate()
+GetContributors()
+Genre
+Actors
+Directors
+Volume
+Issue
+Editors
+Artists
+Name
1
*
*
*
*
*
*
*
*
www.it-ebooks.info


Object-oriented Design
[
 24 
]
Just looking at this class diagram, it feels like we are doing something wrong. It is 
bulky and fragile. It may do everything we need, but it feels like it will be hard to 
maintain or extend. There are too many relationships, and too many classes would 
be affected by modifications to any one class. It looks like spaghetti and meatballs.
Now that we've explored inheritance as an option, and found it wanting, we might 
look back at our previous composition-based diagram, where 
Contributor
was 
attached directly to 
LibraryItem
. With some thought, we can see that we actually 
only need to add one more relationship to a brand-new class to identify the type of 
contributor. This is an important step in object-oriented design. We are now adding a 
class to the design that is intended to 
support
the other objects, rather than modeling 
any part of the initial requirements. We are 
refactoring
the design to facilitate the 
objects in the system, rather than objects in real life. Refactoring is an essential process 
in the maintenance of a program or design. The goal of refactoring is to improve the 
design by moving code around, removing duplicate code or complex relationships in 
favor of simpler, more elegant designs.
This new class is composed of a 

Download 2,95 Mb.

Do'stlaringiz bilan baham:
1   ...   31   32   33   34   35   36   37   38   ...   183




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish