The Contract Enforcement Aspect Pattern
Source: Federal University of Pernambuco
The most fundamental motivation for employing contracts in the development of OO applications is to improve the reliability. Contract enforcement is a well-known established technique in Object-Oriented (OO) programming. However, the need to intercept well defined points in the execution of a program to check design constraints makes the enforcement of contracts a crosscutting concern. Thus, contract enforcement code is inter-wined with the business code, hindering maintenance. Moreover, because of the difficulty in separating contract enforcement code and business code, the former is often duplicated across several different places within a system.