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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

interfaces between different parts of the system might be incompatible, but this might not<br />

become obvious until integration testing or system testing.<br />

Modular L<strong>an</strong>guages such as Modula -2 <strong><strong>an</strong>d</strong> Ada employ modularization. In these l<strong>an</strong>guages a module<br />

hides its data from module users. The users of the module c<strong>an</strong> only access that data via defined<br />

interfaces. These interfaces are “published” so that users know what interfaces are available (<strong><strong>an</strong>d</strong><br />

their definitions) <strong><strong>an</strong>d</strong> c<strong>an</strong> check that they are using the correct versions.<br />

<strong>Object</strong> oriented This is the most recent “commercial” programming paradigm. This approach c<strong>an</strong> be<br />

seen as taking modularization a step further. Not only do you have explicit modules (in this case<br />

objects) but these objects c<strong>an</strong> inherit features from one <strong>an</strong>other. We c<strong>an</strong> of course ask “why<br />

<strong>an</strong>other programming paradigm?”. The <strong>an</strong>swer to this partly lies in the fa ilure of m<strong>an</strong>y software<br />

development projects to keep to budget, remain within time scales <strong><strong>an</strong>d</strong> to give the user what they<br />

w<strong>an</strong>t. Of course, it should never be assumed that object orientation is the <strong>an</strong>swer to all these<br />

problems, it is really just <strong>an</strong>other tool available to software developers.<br />

This book is about this last programming paradigm. It attempts to introduce this paradigm through the<br />

medium of <strong>an</strong> object oriented programming l<strong>an</strong>guage. It assumes that the majority of readers will have a<br />

background in at least one procedural l<strong>an</strong>guage (in particular with a C -like l<strong>an</strong>guage). It therefore<br />

compares <strong><strong>an</strong>d</strong> contrasts the facilities provided with such a l<strong>an</strong>guage at appropriate times.<br />

It should be seen from the above list, that object orientation, even though it is quite different in m<strong>an</strong>y<br />

ways from the procedural approach, has developed from it. You should therefore not throw away all<br />

that you have learnt using other approaches. M<strong>an</strong>y of the good practices in other l<strong>an</strong>guages are still<br />

good practices in <strong>an</strong> object orie nted l<strong>an</strong>guage. However, there will be new practices to learn as well as<br />

new syntax. It will be much more th<strong>an</strong> a process of learning a new syntax - you have a new philosophy<br />

to learn.<br />

1.3 Revolution versus evolution<br />

In almost every area of scientific endeavor t here are periods of evolution followed by periods of<br />

revolution <strong><strong>an</strong>d</strong> then evolution again. That is, some idea or theory is held to be “accepted” (not<br />

necessarily true but at least accepted). During this period the theory is refined by successive<br />

experiments / discoveries etc. Then at some point, the theory is challenged by a new theory. This new<br />

theory is typically held by a small set of extremely fervent believers. It is often derided by those who<br />

are staunch supporters of the existing theory. As time conti nues, either this new theory is proved wrong<br />

<strong><strong>an</strong>d</strong> disappears, or more <strong><strong>an</strong>d</strong> more are drawn to the new theory until the old theory has very few<br />

supports.<br />

There are m<strong>an</strong>y examples of this phenomena in science. For example, the Copernic<strong>an</strong> theory of the<br />

earth rotating around the sun, Einstein’s theory of relativity <strong><strong>an</strong>d</strong> Darwin’s theory of evolution. Men such<br />

as Darwin <strong><strong>an</strong>d</strong> those who led him to his discoveries were revolutionaries. They went against the current<br />

belief of the times <strong><strong>an</strong>d</strong> introduced a new set of theories . These theories were initially derided but have<br />

since become generally accepted. Indeed we are now in <strong>an</strong> evolutionary phase, with regard to the theory<br />

of evolution, where Darwin’s theories are being refined. For example, Darwin believed that the<br />

mech<strong>an</strong>ism of fertilization of <strong>an</strong> egg was derived from <strong>an</strong> old Greek theory referred to as P<strong>an</strong>genesis.<br />

Every org<strong>an</strong> <strong><strong>an</strong>d</strong> tissue was assumed to produce gr<strong>an</strong>ules, called gemmules. These were combined to<br />

make up the sex cells. Of course we now believe this to be wrong <strong><strong>an</strong>d</strong> it was Darwin’s own cousin,<br />

Fr<strong>an</strong>cis Galton, who helped to disprove the P<strong>an</strong>genesis theory. Whether we will enter a new<br />

revolutionary phase where the theory of evolution will be over -turned is probably unlikely, however,<br />

Einstein’s theory of relatively may well be (<strong><strong>an</strong>d</strong> is already being) challenged.<br />

Programming is <strong>an</strong>other example of this revolution / evolution cycle. The move from low level to<br />

high level programming was one such revolution (<strong><strong>an</strong>d</strong> you c<strong>an</strong> still find people who will insist that low<br />

level machine code programming is best). <strong>Object</strong> orientation is <strong>an</strong>other revolution, which in this case is<br />

still happening. Over the past ten years object orientation has become much more widely accepted <strong><strong>an</strong>d</strong><br />

you will find m<strong>an</strong>y org<strong>an</strong>izations, both suppliers <strong><strong>an</strong>d</strong> users of so ftware, giving it lip service. However,<br />

you will also find m<strong>an</strong>y in the computer industry who are far from convinced. A senior colleague of<br />

mine recently told me that he believed that object orientation was severely over -hyped (which it may<br />

be) <strong><strong>an</strong>d</strong> that he really couldn’t see the benefits it offered. Hopefully, this book will convince him (<strong><strong>an</strong>d</strong><br />

others) that object orientation has a great deal to offer.<br />

16

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

Saved successfully!

Ooh no, something went wrong!