### Making an EM model for bubblesort

This presentation concerns a simple way of sorting data, viz. bubblesort.

By clicking on the interactive display on the left, can demonstrate bubblesort in action ...

In describing bubblesort informally, we refer to many things that have to be observed in order to understand the method.

The principle behind our approach is to make these observables explicit by embodying them in a form of computer model.

Terminology is difficult, not least because the 'model' is wide open to interaction and interpretation through which it is made and subsequently evolves.

What term is appropriate depends on the nature of the interaction. Possible terms are:

- artefact - a concrete source of experience whose interpretation may be obscure
- construal - an artefact that serves an explanatory purpose
- model - an artefact that corresponds closely to a specific referent

EM model can mean any of these things, and can apply to the same model when explored and interpreted in different ways.

Demonstrating bubblesort is just one way to exercise the EM bubblesort model.

Our model is first and foremost to be experienced visually - plain as it is!

It reflects those aspects of the state that are significant in (bubble)sorting.

The 7 data items to be sorted are shown in an array - they have a L-to-R order.

This order exists independent of the data - it is built into a geometric structure.

The data itself consists of some numbers that have

- a value that is not explicitly visualised
- an associated representation - in this case by decimal digits

There are more sophisticated observables

- how one data item compares in the ordering with its neighbours
- which data item is the largest and the smallest

Another observable is whether or not the array is sorted.

In the process of bubblesorting, there are other observables, such as what pass is being executed in the sorting. At each pass, some items will have already been placed in order.

The 7 data items to be sorted are shown in an array - they have a L-to-R order.

This order exists independent of the data - it is built into a geometric structure.

The data itself consists of some numbers that have

- a value that is not explicitly visualised

These are encoded in an array called `val`;

    %eden
    val = [7,56,19,90,21,3,46];

execute | copy to input box

- an associated representation - in this case by decimal digits

There are more sophisticated observables

- how one data item compares in the ordering with its neighbours
- which data items are under consideration ...

  The first is data item" " // str(first), and the last is data item" " // str(last).

- ... and of these, which is the largest and the smallest.

  The largest is" " // str(maxelt). The smallest is" " // str(minelt).

Another observable is whether or not the array is sorted.
or more precisely:

In the process of bubblesorting, there are other observables, such as what pass is being executed in the sorting. At each pass, some items will have already been placed in order.

phase_status