Skip to main content

Tool time

Posted by daniel on October 1, 2003 at 3:08 AM PDT

JavaCC, the Java Compiler Compiler, was open-sourced in June here on java.net. Their project has been one of the most popular over the last few months.


The homepage describes JavaCC as

a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.

A check of the Java Grammar Repository lists existing grammars from Ada to XQuery along with requests for perl, php, XSLT, XML Schema, and SIP. The FAQ explains that

JavaCC stands for "the Java Compiler Compiler"; it is a parser generator and lexical analyzer generator. JavaCC will read a description of a language and generate code, written in Java, that will read and analyze that language. JavaCC is particularly useful when you have to write code to deal with an input language has a complex structure; in that case, hand-crafting an input module without the help of a parser generator can be a difficult job.

When you're ready to download and try out JavaCC, you'll find a rich array of resources and a large and supportive community.


Also today in Projects and Communities, the Java Web Services and XML community links to the Performance Tuning newsletter. It contains an article that asks the question Assertions, On or Off. On the one hand you may be tempted to strip out all of the assertions for production code. On the other hand, "deployed code should retain as much error checking as possible." The decision comes down to an assessment of whether the assertion code is burning a lot of cycles. The answer is fuzzy and depends on you testing your local situation.

if you identify that assertions are causing a performance bottleneck, then selectively turning them off is a valid performance tune. Chances are that you will only need to turn off some assertions, those in the bottlenecked section of the code. But if your application is liberally laced with assertions throughout the code, it may be the sheer volume of assertions causing a performance problem, in which case you may have to turn them all off by default, and selectively enable those that are really essential for the production system.


In Also in Java Today the benefits of loose coupling and programming to interface may seem obvious to us now. Not too long ago, we thought that OO was all about inheritance. Charlie Calvert reminds us that we are talking about inheritance of an interface and not of an implementation. In Calvert's Borland Developer Network article Interfaces and Loose Coupling in Java he writes that programs become easier to understand and that you end up defining a contract that promotes reuse.

How do you support both the J2SE 1.3 and the J2SE 1.4 stacks. They're different. Switching from one to the other can break an application. In the JavaWorld feature Overcome J2SE 1.3-1.4 incompatibilities, Sam Mefford shows that the "Reflection API allows for calling methods that may not exist, and Ant allows imports to change on-the-fly to support dependencies on classes that may not exist under the compiling Java version."


Andreas Schaefer has a suggestion that will make "the life of EJB developers and application server administrators easier and the deployed applications more robust. In his Weblog entry How to Handle Permanent Exceptions after EJB Deployment, Andy writes that because you can't depend on an enterprise app running smoothly all the time, it would be helpful if

the EJBContext would allow the EJB to inform the server about an unrecoverable error with a message and a Throwable instance. This allows the server to take the EJB and/or the entire application in question down and return an appropriate EJB- or RemoteException to a caller to inform about the original problem. The server then can inform the administrator about the problem or can try to restart the EJB/Application periodically (in the case of MDBs).

Shaefer suggests and explains a possible syntax for handling such cases.

Jack Shirazi has posted the contents of the September Java Performance News. In addition to 50 new tips and an answer to whether turning assertions off is a bad practice, the latest issue includes an "interview with Frank Cohen, the creator of the open source TestMaker webservices load tester."

Philip Brittan writes that decisions about infrastructure and about application selection are typically made by different groups in an organization. It would follow, he suggests in his blog entry Open Standards: Apps and infrastructure, that it would be beneficial to decouple these decisions and this separation is one of the key benefits of open standards.


In today's java.net News Headlines :

Registered users can submit news items for the href="http://today.java.net/today/news/">java.net News Page using our
news submission form.
All submissions go through an editorial review by news director Steve
Mallet before being posted to the site. You can also subscribe to the href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net News RSS
feed.


Current and upcoming Java Events:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e"> events submission form.
All submissions go through an editorial review before being posted to the
site.


This blog is delivered weekdays as the href="http://today.java.net/pub/q/java_today_rss?x-ver=1.0">Java Today RSS
feed. Once this page is no longer featured as the front page of href="http://today.java.net"> Java Today it will be archived at href="http://today.java.net/today/archive/index_10012003.html">
http://today.java.net/today/archive/index_10012003.html. You can
access other past issues in the href="http://today.java.net/today/archive/">java.net Archive.