Thursday, November 18, 2021

PigeonTalk Phase 2

 For many years, I've been teaching programming courses.  In order to help people visualize how object oriented programming works, I've developed an analogy.  Imagine a person sitting at a desk.  The person corresponds to an object.  In front of the person is a pile of instruction books.  There's one book for the class and one for each of its superclasses.  Also on the table is a sheet of paper where you have written down your instance variables and another ready for temporary variables.

When a message arrives, you read it and look up the instructions for the method named by the message.  You look in book for your own class first then go through the books for the superclasses until you find the method.

You then start running the instructions in the book.  When you get to a message send, you write a message to an object and send it off.  You then take a coffee break until the answer returns.


This image represents that analogy graphically.  The blue sphere on the right helps identify the kind of object.  Every class would have an icon displayed on the table.  To the left of the sphere are the books for your class and superclasses.  Below it are the instance variables and the current values.  The pink area represents temporary variables.  The green area is the message that arrived with the argument displayed.  Finally the gray area contains the code.

The code doesn't need to be represented as text.  We can use drag and drop to build the code.  The red left arrows indicate variable assignment and the up arrows represent returns.  The message in black with white text is the next message to be executed.

This is just a graphical representation of where I'm heading.  The final result may not look like this (since it was rendered in 3D with POV-Ray) but it shows what I'd like to do.

I'd like to be able to "zoom out" and see the network of objects that make up the application.  Lines would connect objects corresponding to the instance variable values.  This aspect of the system is inspired by Kent Beck's Object Explorer.  Finally, I'd like to be able to animate the execution of the program with glowing lines to show the current thread of execution.  You can watch the messages flow from object to object and return back.  You should be able to speed up or slow down the animation or pause it altogether.

The system would include breakpoints, data watchpoints (breakpoints that trigger when variables change values).  Breakpoints and watchpoints could be made conditional so they are only hit if the condition passes.

There's certainly a lot to do, but I'm moving along that path.



No comments:

Post a Comment