29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32.5.5 The whole enchilada<br />

Behaviour<br />

Behaviour<br />

class<br />

ClassDescription<br />

ClassDescription<br />

class<br />

Class<br />

Class class<br />

<strong>Object</strong><br />

<strong>Object</strong> class<br />

Collection<br />

Collection<br />

class<br />

Metaclass<br />

Metaclass<br />

class<br />

Set<br />

Set class<br />

aDictionary<br />

Dictionary<br />

Dictionary<br />

class<br />

Figure 32.8: Combining both the inst<strong>an</strong>ce <strong><strong>an</strong>d</strong> class relationships<br />

The last two sections have considered the inst<strong>an</strong>ce relationship <strong><strong>an</strong>d</strong> the inherit<strong>an</strong>ce relationship between<br />

classes in <strong>Smalltalk</strong> respectively. Each of these in isolation isn’t too complicate d, however when you<br />

put the two together you obtain a diagram such as that illustrated in Figure 32.8.<br />

This figure illustrates the inst<strong>an</strong>ce <strong><strong>an</strong>d</strong> inherit<strong>an</strong>ce relationships between classes <strong><strong>an</strong>d</strong> metaclasses. As<br />

c<strong>an</strong> be seen f rom this diagram the overall structure is quite complex. However, if you study it closely<br />

you should find that it does make sense. Even when there appears to be the potential for excessive<br />

circularity it c<strong>an</strong> be seen that this is not the case. There is one point of circularity which should be<br />

noted, that is <strong>an</strong> <strong>Object</strong> is <strong>an</strong> inst<strong>an</strong>ce of <strong>Object</strong> class which (eventually) inherits from Behavior<br />

which inherits from <strong>Object</strong>.<br />

32.6 Further reading<br />

See Chapters 5 <strong><strong>an</strong>d</strong> 16 in the Purple Book [Goldberg <strong><strong>an</strong>d</strong> Robson 1989] for <strong>an</strong> in troduction to<br />

metaclasses <strong><strong>an</strong>d</strong> a detailed description of the class Class, Metaclass, ClassDescription <strong><strong>an</strong>d</strong><br />

Behavior. However, the actual description of the metaclass concept <strong><strong>an</strong>d</strong> the diagrams presented with<br />

it are a little confusing. Also see Chapter 26 of [ Hopkins <strong><strong>an</strong>d</strong> Hor<strong>an</strong> 1995] for <strong>an</strong> excellent introduction<br />

to metaclasses.<br />

Part Seven<br />

The Future<br />

275

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!