Programming units

Units of design frequently equal units of execution. But this isn’t necessarily so.

In object oriented program, the unit of design is the object. Usually, the objects are units of execution also, but this is only necessary if polymorphism is being used.

In functional programming, one very often creates a lot of little functions. These are the units of design. But, at least in the small games I’ve written so far, many of them are used one or very few times. They would be inefficient units of execution, something I hope the compiler would take into account.

C compilers understand this to a limited extent – they do function inclining in some cases. Some of them may even do function abstraction, especially in space optimization mode.

Posted Monday, July 12th, 2004 under Essay.