28.03.2014 Views

isbn9789526046266

isbn9789526046266

isbn9789526046266

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

A high-level OO machine?<br />

Sajaniemi and Kuittinen’s object-oriented notional machine operates on the same level of abstraction as<br />

their procedural notional machine, dealing with primitives such as variables and stack frames. In contrast,<br />

Bergin emphasizes the dramatically different way computation is thought about in OOP:<br />

One fairly typical component of a beginning course of programming using the procedural<br />

paradigm is a discussion of the von Neumann machine architecture. [. . . ] This simple machine<br />

model fits well with the procedural paradigm, but less well with other, more abstract, ways of<br />

looking at computation. There is a simple relationship between the physical level provided by<br />

the von Neumann architecture and the virtual level provided by most procedural languages.<br />

This is just not the case with the functional or object-oriented paradigm. The functional<br />

paradigm, of course, completely hides the underlying physical architecture. The objectoriented<br />

one does not hide it, but turns it on its head. Instead of the data being moved<br />

to the CPU for processing, a very common metaphor in OOP is that the CPU moves inside<br />

the objects. (Bergin, 2000)<br />

Gries (2008) also criticizes the use of low-level abstractions in teaching object-orientation:<br />

But many programming texts fail to use abstraction appropriately, e.g., by describing variables<br />

and assignment in terms of computers [. . . ]<br />

“A variable is a name for a memory location used to hold a value of some particular data<br />

type.”<br />

“When [the assignment statement is] executed, the expression is evaluated . . . and the<br />

result is stored in the memory location . . . .”<br />

“The computer must always know the type of value to be stored in the memory location<br />

associated with a variable.”<br />

“An object reference variable actually stores the address where the object is stored in<br />

memory.”<br />

[. . . ] introducing computing concepts in terms of the computer can create unnecessary and<br />

confusing detail, especially when OO concepts are described in terms of a computer, with<br />

discussions of pointers to objects in memory, heaps, and other implementation-related terms.<br />

(p. 32)<br />

Gries prefers to scrap difficult terminology – e.g., ‘reference’, ‘pointer’ – as “with appropriate abstraction<br />

away from the computer, these terms become unnecessary”. We saw Gries’s higher-level conceptual model<br />

of objects and classes in Section 10.3.<br />

In a similar vein to Gries, Caspersen and his colleagues (Caspersen, 2007; Bennedsen and Schulte,<br />

2006; Henriksen, 2007) have sought to represent an object-oriented notional machine on a higher level<br />

of abstraction. They argue that object-oriented programmers need to understand program execution in<br />

terms of a notional machine that deals with interacting object structures. Henriksen (2007) envisioned a<br />

visualization of a notional machine that would abstract out execution details such as expression evaluation<br />

and concentrate on object interactions. Caspersen (2007) outlines a future system in which students could<br />

‘play’ with the visualization of an object model, stepping forward and backward, and making changes to<br />

program state at will (cf. Victor, 2012).<br />

Two machines?<br />

Berglund and Lister (2007, 2010) found through phenomenographic analysis that amongst participants<br />

in the objects-early debate, objects early is experienced in different ways: as learning an extension<br />

of imperative programming or as learning something conceptually quite distinct from imperative<br />

programming. This qualitative divide is, in my interpretation, reflected in the literature on object-oriented<br />

138

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

Saved successfully!

Ooh no, something went wrong!