Friday, November 10, 2017

iContract for Java...


  • Many programming languages have facilities to make assertions
  • iContract in Java is one such.
  • iContract is a preprocessor for Java. To use it, you first process your Java code with iContract, producing a set of decorated Java files. Then you compile the decorated Java code as usual with the Java compiler.
  • All iContract directives in Java code reside in class and method comments, just like Javadoc directives. In this way, iContract ensures complete backwards-compatibility with existing Java code, and you can always directly compile your Java code without the iContract assertions.
  • In a typical program lifecycle, you would move your system from a development environment into a test environment, then into a production environment. In the development environment, you would instrument your code with iContract assertions and run it. That way you can catch newly introduced bugs early on. In the test environment you may still want to keep the bulk of the assertions enabled, but you should take them out of performance-critical classes. Sometimes it even makes sense to keep some assertions enabled in a production environment, but only in classes that definitely are in no way critical to your system's performance. iContract allows you to explicitly select the classes that you want to instrument with assertions.
Pre and post conditions with iContract


Invariant with iContract

















Source: 




No comments:

Post a Comment

Full capabilities of ChatGPT 4 O (O for Omni) - From Openai.com

Omni, O, has multimodal capabitlies, which means it can take text, voice or video as an input and serve audio/text/image output (there's...