Contract-based programming

Today I came across Larry Osterman's blog, who has an interesting series on this topic.

This is one direction where programming languages should make a step forward, adding better support for that paradigm, especially moving implicit contract properties and runtime checks like valid-value-ranges, into the language syntax. A recent example of that are Java Enumerators, which can be used to force the programmer to use one out of the valid given 'constant' objects, but restrict creation of new ones, thus enabling the programmer to narrow down the parameters to a given method to those that the method is really supposed to work on.

No comments: