Outline
Implement the ideas from the Eiffel language regarding design by contract in Java.
Implementation Notes
- Ideally, these are specified as annotations pointing to
RuleSet objects
- Other than the Eiffel counterpart, these condition statements should be validated on build-time execution, by informing test-cases, rather than crashing the program during runtime processing.
- Will likely require AOP implementation of sorts
Usage Desisderata
@ValidatedBy(aValid(SomeObject.class).must(notBeNull).must(haveNonNullField(SomeObject::name)).iHaveSpoken())
class SomeObject {
private String name;
@PreCondition(adheresTo=aValid(SomeObject.class).must(haveNonNullField(SomeObject::name)).iHaveSpoken())
@PostCondition(adheresTo=aValid(SomeObject.class).must(haveNonNullField(SomeObject::name)).iHaveSpoken())
public Result doSomething(InputClass input) {
}
}
Outline
Implement the ideas from the
Eiffellanguage regarding design by contract in Java.Implementation Notes
RuleSetobjectsUsage Desisderata