next up previous
Next: MM's foundations: System Limit Programming
Up: MODEL MASTER: MAKING SPREADSHEETS SAFE

First presented at CALECO
Previous: Systems as objects


Timeless objects

Both examples so far have involved objects which change with time. MM can also be used for objects where time is irrelevant. An example would be where one needs to calculate the cost of painting a set of rooms, estimating each room's needs from the surface area of its walls:

object room {
  < area:real length:real width:real height:real >
  area = 2*length*height +
         2*width*height
}

object bathroom {
  inherits( room )
  length = 10 & width = 12 & height = 14
}

object bedroom {
  inherits( room )
  length = 12 & width = 16 & height = 14
}

object house {
  inherits( bathroom + bedroom )
  < paint_unit_cost:real total_cost:real >
  paint_unit_cost = 326
  total_cost = (bathroom.area + bedroom.area) * paint_unit_cost
}
Here, our system both creates two instances (using the name of their parent objects, since there is only one of each); adds two new attributes; and then defines relations between them and the area attribute of its components.



Jocelyn Ireson-Paine
Sat Nov 28 17:42:14 GMT 1998