C-Kermit Case Study #28

[ Previous ] [ Next ] [ Index ] [ C-Kermit Home ] [ Kermit Home ]

Newsgroups: comp.protocols.kermit.misc
From: thucdat@hotmail.com (Dat Nguyen)
Subject: Case Study #28: Simulation
Date: 4 May 2004 12:30:24 -0700
Organization: http://groups.google.com

We simulate things to predict the future. Alan Kay, the grand visioner of Smalltalk, boldly stated: "The best way to predict the future is to create one".

Well, let's create one in C-Kermit. Yes, it doesn't have to be in Smalltalk.

I am going to open an ice cream store, I would like to forsee the profit. Sure and again, the whole thing is easier to do in OOP fashion, even though I also feel at home in 8080 assembler.

The objects of this simulation are the store, the customers, the container to keep track of the events happening at the store: customer arrivals, customer orders, customer departures; even the random distribution of events are objects of classes.

The same idea to handle realtime events is used here: there is a process object with a queue waiting for events to come and executes them.

Speaking OOP, what about inheritance? You'll find it here! Smalltalk allows only single inheritance, C++ and ... OOP in C-Kermit offers both: single and multiple inheritance; but that is a subject of another post.

In this simulation, not objects but the events are passed around, stored and executed when time dues. Everything is very Smalltalk-like, but written and executed entirely in C-Kermit.

The simulation of an ice cream store is implemented in Smalltalk in the book A Little Smalltalk, by Tim Budd, Addison-Wesley 1987.

The implementation in C-Kermit is found at:



[ Top ] [ Previous ] [ Next ] [ Index ] [ C-Kermit Home ] [ Kermit Home ]

Kermit Case Study 28 / Columbia University / kermit@columbia.edu / 4 May 2004