Prototypal OOP is an attractive way of doing “exception-driven” modeling: foo is like bar except that …. It is particularly suited to situations where you have many possible small distinguishing traits from a base type.

It has a major problem, however: the prototype is in most such systems an object that can have messages sent to it. This is often completely nonsensical. Defensive programming has to be put in place to prevent calls to methods on the prototype instead of its descendants.

Logtalk’s categories solve this problem in a strikingly elegant way, giving class/instance-like functionality to the wildly more flexible prototype concept. This blog explains both why and how.