Author Dusty Phillips Reviewers



Download 2,95 Mb.
Pdf ko'rish
bet22/183
Sana20.07.2022
Hajmi2,95 Mb.
#831085
1   ...   18   19   20   21   22   23   24   25   ...   183
Bog'liq
python3-oop

[
 12 
]
The objects in an object-oriented system occasionally represent physical objects such 
as people, books, or telephones. More often, however, they represent abstract ideas. 
People have names, books have titles, and telephones are used to make calls. Calls, 
titles, accounts, names, appointments, and payments are not usually considered 
objects in the physical world, but they are all frequently-modeled components in 
computer systems.
Let's try modeling a more computer-oriented example to see composition in 
action. We'll be looking at the design of a computerized chess game. This was a 
very popular pastime among academics in the 80s and 90s. People were predicting 
that computers would one day be able to defeat a human chess master. When 
this happened in 1997 (IBM's Deep Blue defeated world chess champion, Gary 
Kasparov), interest in the problem waned, although there are still contests between 
computer and human chess players. (The computers usually win.)
As a basic, high-level analysis, a game of chess is played between two players,
using a chess set featuring a board containing sixty-four positions in an 8 X 8 grid. 
The board can have two sets of sixteen pieces that can be moved, in alternating
turns by the two players in different ways. Each piece can take other pieces. The 
board will be required to draw itself on the computer screen after each turn.
I've identified 
some of the possible objects in the description using 
italics
, and a few 
key methods using 
bold
. This is a common first step in turning an object-oriented 
analysis into a design. At this point, to emphasize composition, we'll focus on the 
board, without worrying too much about the players or the different types of pieces.
Let's start at the highest level of abstraction possible. We have two players 
interacting with a chess set by taking turns making moves:
Player 1
Player 2
Chess Set

Download 2,95 Mb.

Do'stlaringiz bilan baham:
1   ...   18   19   20   21   22   23   24   25   ...   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