Archive for the 'Java' Category

Warming Up For JavaPolis

12122007173_800.jpg

2007-12-12. No responses.

A Late Arrival

This plan was doomed from the start: leave from work at 4PM and try to reach Antwerp within two hours, so I could collect my badge and goody bag tonight instead of tomorrow morning (together with 2000 fellow JavaPolis visitors). It was worth a try, but I should have known you can’t beat the Dutch rush hour at its peek. Exactly one hour late (an hour spent halfway through in a traffic jam caused by people looking at an accident on the other side of the road) I entered the Metropolis building–only to be disappointed by Stephan himself. So that’s one beer less to drink tonight, in an attempt to go to bed early and be on time tomorrow morning.
Anyway, all will be forgotten when I sit down tomorrow for the first keynote–and after that for all those sessions I’m looking forward to: Gosling, Gafter, Bloch… Sessions about EJB3.1 and Guice and Scala… (Of course, since I didn’t get the goody bag with the program yet, I’m listing all these from memory so I’ve probably forgotten one or two). I’m sorry to say I will probably miss the JRuby session with Ola Bini and Charles Nutter: you can only see so many introductions into Ruby and Rails.
And in the meantime I’ve done a little reconnaissance in Antwerp’s town center after checking into the hotel. As always, the city is great fun to be in Christmas time: nicely decorated and full of life (and beer). I had some Belgian fries at Frituur No 1 and walked around town a little. I nearly bumped into someone looking a lot like James Gosling, taking snapshots of the Antwerp cathedral. Perhaps not the right moment to ask for an autograph…

11122007171_320.jpg

On the road to Antwerp…

2007-12-11. No responses.

JavaPolis Going Nuclear

Just when I was about to drive off to Antwerp for this year’s JavaPolis, I learned that a fire has started in Antwerp’s nuclear plant ‘Doel’. Apparently the fire is located in a side building and there’s no immediate danger to the public. Which is exactly what I would say to prevent complete chaos from breaking out…

2007-12-11. No responses.

Java Closure Examples

One thing I miss in the current BGGA proposal for closures in Java 7, is a good set of examples. There are some examples, but they don’t cover most situations. Also I feel that more examples might better show the advantages of having closures in Java. Of course, as long as the Java compiler has not been patched to work with closures, this remains “swimming on dry land” (as we say in Holland). Syntax errors will no doubt be abundant, and everything might change with the next version of the proposal. I hope this will still be useful to people wondering why there should be closures in Java in the first place. This is why: it makes your code cleaner and leaner.

So here goes, starting with some simple examples. Each example consists of the closure method usage (which will probably be used most) and the closure method definition (which will mostly be done by library developers).

Select objects from collection

This is an example of how the CollectionUtils utility methods could be rewritten using closures.

public Collection<Book> getPublishedBooks(Collection<Book> books) {
    return select(books, {Book book =>
        book.isPublished()
    });
}

/**
 * Returns the T objects from the source collection for which the
 * given predicate returns true.
 *
 * @param source
 *            a collection of T objects, not null
 * @param predicate
 *            returns true for a given T object that should be
 *            included in the result collection
 * @return a collection of T objects for which the predicate
 *         returns true
 */
public static <T> Collection<T> select(Collection<T> source,
        {T=>Boolean} predicate) {
    Collection<T> result = new ArrayList<T>();
    for (T o : source) {
        if (predicate.invoke(o)) {
            result.add(o);
        }
    }
    return result;
}

Continue Reading »

2007-02-05. 17 responses.

Test Your Ruby Skills On JavaBlackBelt.com

JavaBlackBelt is a fast growing community whose members take tests to assess their skills in various Java-related topics. The tests themselves are created also by the site’s members. A small number of Ruby enthusiasts is currently working to add a Ruby exam to this Java-oriented site. I interviewed Mr. John Rizzo, one of JavaBlackBelt’s founders, and asked him what JavaBlackBelt has to offer Java and Ruby developers.

Danny: Why do we need JavaBlackBelt if we already have Sun’s Java certificates?

John Rizzo, co-founder of JavaBlackBeltJohn: We felt that, in the real world, with real teams and real projects, we have no way to assess, in an objective way, Java developers. Java requires so many things to learn. Sun is responsible for many Java apis, like JMS, Java2D, Swing, JDBC, servlet, EJB and so on. But their exam covers only a very small part of that. For example, the Sun Certified Java Programmer (SCJP) is a coverage of a small part of Java SE; JDBC, simple database access, is not even in it. And there are so many other tools and apis that are covered by other groups: Jakarta, Eclipse, jBoss. Their core business is developing their framework, not doing certifications. So there is nothing for this. If you see what a Java developer has to learn the first six months, or the first one or two years, to be productive in a project… All these technologies, and certification covers a very small part, maybe less than 10%. This is the first reason.

The other reason is that when you have three years of experience as a Java developer, and you’d like to do the first Sun certification (SCJP), you still need to study for a few days before you can take the test. Is that normal? You are an experienced developer, and you need to study, before Sun recognizes your skills. That’s why the exams on JavaBlackBelt are made keeping in mind that the candidates have all the resources available. Books, Eclipse, Google, whatever. They can search the web, search the Java apis, they can try things out in Eclipse. They’re only limited by time. They don’t have to remember things by heart. But the exams are hard, even with that. It depends on the exams, we also have basic exams, to help the beginners and to encourage the beginner to learn. Like Ruby Basic for example. And then we have more advanced exams; not just one big certification with a lot of questions.
Continue Reading »

2007-01-29. No responses.

« Prev - Next »