Most interesting links of October

Recommended Readings Steve Yegge’s Execution in the Kingdom of Nouns – I guess you’ve already read this one but if not – it is a well-written and amusing post about why not having functions as first class citizens in Java causes developers to suffer. Highly recommended. Reply to Comparing Java Web Frameworks – a veryContinue reading “Most interesting links of October”

JSF: Beware the Difference Between Build-Time and Render-Time Tags in Facelets

This is to remind me that I should never ever forget the cruical difference between build-time-only tags (i.e. having tag handlers only) and render-time tags that have corresponding components. The problem is that their lifespan is different and thus mixing them can easily lead to nasty surprises. Build time tags are used to modify theContinue reading “JSF: Beware the Difference Between Build-Time and Render-Time Tags in Facelets”

Never Mix Public and Private Unit Tests! (Decoupling Tests from Implementation Details)

It seems to me that developers often do not really distinguish between the various types of unit tests they should be writing and thus mix things that should not be mixed, leading to difficult to maintain and hard to evolve test code. The dimension of unit test categorization I feel especially important here is theContinue reading “Never Mix Public and Private Unit Tests! (Decoupling Tests from Implementation Details)”

Hacking A Maven Dependency with Javassist to Fix It

Have you ever wondered what to do when needing “just a small change” to a third-part library your project depended on? This post describes how to use Maven and Javassist to take a dependency of your project, instrument it to modify its behavior, re-pack it, and release it as an artifact with a different nameContinue reading “Hacking A Maven Dependency with Javassist to Fix It”

Comparison of Eclipse 3.6 and IntelliJ IDEA 10.5: Pros and Cons

After having worked with Eclipse for over 5 years I’ve came to use IntelliJ IDEA intensively on a J2EE project in three months and took this as an opportunity to compare the two. You can’t really compare 5 years and 3 months but I still believe that it is long enough to get a prettyContinue reading “Comparison of Eclipse 3.6 and IntelliJ IDEA 10.5: Pros and Cons”

Only a Masochist Would Write Unit Tests in Java. Be Smarter, Use Groovy (or Scala…).

I like writing unit tests but Java doesn’t make it particularly easy. Especially if you need to create objects and object trees, transform objects for checking them etc. I miss a lot a conscise, powerful syntax, literals for regular expressions and collections, conscise, clojure-based methods for filtering and transforming collections, asserts providing more visibility intoContinue reading “Only a Masochist Would Write Unit Tests in Java. Be Smarter, Use Groovy (or Scala…).”

Intro: Java Webapp Monitoring with Hyperic HQ + How to Alert on Too Many Errors in Logs

This post describes how to set up the Java-based open source monitoring tool Hyperic HQ to monitor application server error logs and send a single warning e-mail when there are more of them than a threshold. In the previous post Aggregating Error Logs to Send a Warning Email When Too Many of Them – Log4j,Continue reading “Intro: Java Webapp Monitoring with Hyperic HQ + How to Alert on Too Many Errors in Logs”

Aggregating Error Logs to Send a Warning Email When Too Many of Them – Log4j, Stat4j, SMTPAppender

Our development team wanted to get notified as soon as something goes wrong in our production system, a critical Java web application serving thousands of customers daily. The idea was to let it send us an email when there are too many errors, indicating usually a problem with a database, an external web service, orContinue reading “Aggregating Error Logs to Send a Warning Email When Too Many of Them – Log4j, Stat4j, SMTPAppender”

hasProperty, the Hidden Gem of Hamcrest (and assertThat)

If you got used to JUnit 4’s assertThat with various matchers (of course you will need junit-dep.jar and hamcrest.jar to get the full set instead of the small subset integrated in junit.jar), make sure you don’t overlook the matcher hasProperty. It is very useful if you have non-trivial objects and cannot use some more flexibleContinue reading “hasProperty, the Hidden Gem of Hamcrest (and assertThat)”

Spring: Make an Externally Created Object Available to Beans in applicationContext.xml

If your Spring beans need access to an object that is not created by Spring itself, you can “inject” it into the context by using a static parent context and registering the object with it. Beans can then reference it just as if it was defined in the application context file. Java: Configure ApplicationContext withContinue reading “Spring: Make an Externally Created Object Available to Beans in applicationContext.xml”