Posted by Dean Wampler
Fri, 02 Mar 2007 16:03:00 GMT
A Contract4J5 user reported performance problems using Groovy. After some investigation, it appears that using the Bean Scripting Framework (BSF) increases the overhead of script evaluation by a factor of 3 or so! The overhead for script evaluation is already very high (roughly a factor of 7-10 times slower compared to no contracts). Scripting is expensive if used heavily, as it is in C4J!!
I’m not sure why BSF’s overhead is so high, but I’m going to implement support for Groovy and JRuby that bypasses BSF. This may take a while to complete, as I have a busy few weeks ahead.
The older non-BSF integration with Jexl is still in the distribution (although it’s currently marked as deprecated). If you want to use it, put the following code in your main or similar initialization methods:
Contract4J c4j = Contract4J.getInstance();
ContractEnforcer ce = c4j.getContractEnforcer();
ce.setExpressionInterpreter (new JexlExpressionInterpreter());
Correction: You can also use the properties file configurator or the Spring configuration file options to specify Jexl without the BSF wrapper.
You’ll get warnings that JexlExpressionInterpreter is deprecated. You can safely ignore them. I’ll remove that javadoc tag in the next minor update.
Longer term, I’m trying to improve the use of caching to further reduce the overhead of C4J.
Posted in Contract4J | Tags BSF, Contract4J | no comments
Posted by Dean Wampler
Fri, 22 Sep 2006 02:07:00 GMT
After a longer-than-expected effort, I’m pleased to announce the v0.6.0 release of Contract4J5.
The API for writing contract tests has not changed, but the internals have been restructured considerably to improve the code quality and make it easier to configure Contract4J5 using property files and Spring Framework Dependency Injection.
The release also provides examples of using Contract4J5 with binary weaving or load-time weaving. The latter is now the preferred way to introduce Contract4J5 into a “pure-Java” environment.
For more details, see the
Release Notes in the README or browse to http://www.contract4j.org.
Posted in AOP, Java and AspectJ, Contract4J | Tags AOP, AspectJ, Contract4J
Posted by Dean Wampler
Thu, 13 Apr 2006 18:34:00 GMT
This is my inaugural blog hosted on my own web sites. My previous blogs can be found here.
My article on Contract4J went live on Tuesday, April 11 at IBM’s developerWorks.
In the article, I introduce Design by Contract and describe how Contract4J supports DbC in Java, using AspectJ under the hood. I end the article with a discussion of the emerging trends in aspect-oriented design using interfaces. That is, how the familiar interface-based design we’re used to in OOP is being extended to support aspects.
I intend to explore Aspect-Oriented Design in more detail in coming blogs. Please stay tuned!
Posted in AOP, Java and AspectJ | Tags AOP, AspectJ, Contract4J, developerWorks | no comments