February 03, 2006

Moved

After a few nice years on blogs.cocoondev.org, I'm moving to a new installation. My Java feed moves here.

Posted by tomk at 09:16 PM | Comments (0)

JavaPolis Audio

Romain reports that the JavaPolis 2005 reports are being put on-line. Nice stuff - although I still miss the "get audio only as an mp3 file" feature. I've been listening to JavaPosse during my commute the last few days, and I like it. Too bad this isn't (yet?) possible with the JavaPolis talks.

Posted by tomk at 12:52 PM | Comments (0) | TrackBack

February 02, 2006

Switch from Eclipse to Netbeans

Shay demands not to switch from Eclipse to Netbeans. I'm bedazzled. Why would I switch? Just use them side-by-side: Eclipse for the serious work, and Netbeans to play with Matisse!

Posted by tomk at 03:11 PM | Comments (0) | TrackBack

January 25, 2006

Why I'm not on Java 5 yet

Norman Richards asks why people aren't moving to Java 5. One word: WebSphere. Most corporate environments (the ones I know and/or work with, at least) have not moved beyond 5.1 yet. I'm not even sure that there already exists a JDK 5.0-based WebSphere version.

Posted by tomk at 10:49 AM | Comments (4)

January 18, 2006

Turn around and run!

Charles:

This sort of language trivia is unlikely to be useful to anyone not just about to go into a certification exam, or entirely the wrong kind of programmer interview.[...]
If you find yourself in a situation where have to know the answer to any of these questions, turn around and run.

Right on!

Posted by tomk at 03:22 PM | Comments (0) | TrackBack

January 11, 2006

Null check

Java developers are trained time and again to assert that objects are not null. This can result in weird Pavlov-like reflexes. Witness this snippet from a high-profile OSS project:

if (defaultValue != null) {
    return defaultValue;
} else {
    return null;
}
Posted by tomk at 12:34 PM | Comments (4)

January 04, 2006

The Quest for the Generic CRUD Web Application

More than once in my career, I had to develop a "simple and easy-to-extend" CRUD web application. Every time, I thought "Somebody must have done that already!", and every time, Google returned next to zero results.

My luck seems to be changing slowly, though. My latest effort delivered 3 CRUD engines for Java:

RIFE CRUD
Belgian! But tightly coupled to the RIFE framework, which still doesn't have got the momentum from the big frameworks.
Trails
This seems to be a very interesting bet to go with. However, it is bound to JDK 5.0 and Tapestry. While I personally like both choices, JDK 5.0 is still not done in some environments, leaving me very frustrated.
AppGen
CRUD generation framework to use with AppFuse. AppFuse itself is based on all the usual suspects, and gives you the choice between them: Hibernate or iBatis, Spring, Struts, SpringMVC, WebWork, and so on. However, the founder of the project (Matt Raible) has some problems with code generation tools, leading to an incomplete tool.

The best approach for writing such a CRUD application framework seems to be that of the last two. Use a stack of well-known components, glue them together with your own special goo, and you have something that is at least based on something known. But the first one is a bit too cutting-edge for the typical Big Company, and the last one is a bit too incomplete for Feelings of Hopping Up and Down.

At the moment, I'm giving a go to 2 CRUD projects, one personal and one professional. For the personal one, I'm going with Trails (finally, generics! ;) ), and the professional one will probably be an extension of AppGen. If you have other suggestions, I'll be more than happy to hear about them. And I hope that next time, my Google query will lead to even more results. Or maybe I should finally start scratching that itch myself...

Posted by tomk at 06:25 PM | Comments (2)

December 20, 2005

Javapolis

On special request: my very own personal wrap-up of Javapolis 2005!

Monday
Browsing the Interweb to see what's happening over in Antwerp. Amazed to not find much. Concluded that either half of Antwerp had a power blackout, or that Java geeks are not geeky enough to do that real-time blog thingy. (It turned out that there were problems with the local WiFi hotspot). Went to bed with a splitting head-ache.
Tuesday
Woke up with a splitting head-ache. Spent the day in a room with about 20 other men, including Koen. Called for medical assistance (which was delivered as Nurofen tablets). Noticed weird smells near the end of the day, including own brain melting. Time has never advanced so fast. Probably has something to do with fun.
Wednesday
Finally! The first real Javapolis day! Still headache though. Stephan started a keynote, followed by some important people at Sun who flung t-shirts into the masses.Then a Bea guy started a talk too. I received a phone call: "could you please come to the RAD race jury". Thanks to some manufactured serendipity, I was sitting in the front row. On the opposite site of the exit. Koen and I had to both stand up, dash between one speaker ("Sorry!") and 2000 attendees, and make our way through people sitting on stairs. Luckily, Stephan was so kind to point out that we were going to the jury. 2000 people were a bit less annoyed.
Neal Gafter and Joshua Bloch gave another sequence of "Java puzzles". Very amusing. Too bad that they wanted to go over their time slot so badly.
I stayed put for "EJB3", not expecting to find out much news since last year. Halfway the presentation, I got another telephone call: "are you aware that your son is still at school? Wasn't he ought to be picked up by now?" Light feeling of panic. Fleed conference room once again. 20 minutes of phone calls later ("Damn! Why didn't I charge my batteries last night!"), everything was arranged for.
During lunch, I had to go to the men's room pretty badly. Went there. Saw the line. Huge. Turned around.
Started the afternoon with "Service Data Objects". Was a bit confused: was this guy trying to give an introductory overview, or a technical presentation on how to configure Service Data Objects? There seemed to be some nice ideas somewhere, but I lacked a bit of context (I don't think I encountered the term before entering the conference room).
Entered "Pragmatic SOA". This looked like a very nice presentation. Nothing too new (technically), put pinpointing pretty precisely the clash one can experience when discussing stuff like this with business people. About halfway, my blatter reminded me of the stupid decision I made earlier. Another dash to the exit.
After the relief, I decided to stumble into another room. I picked "continuous integration, continuous agitation", which rehashed a bit all principles of continuous integration, and gave a view on some tools that added value on that by providing graphs of the results.
Then Johan Lybaert shared his experience with agile development in a team of 60+ people. This was one of the nicest surprises here: well told, interesting experience. It feels that this is what a "conference" should be about: exchanging experience and learning from each other. Or what a "User Group" is about, for that matter.
Last session of the day was "Shale: the next struts?" I sighed a sigh of relief when the speaker said "shale has nothing to do with struts - it's just a brand name". And then he continued to describe all source and configuration files one has to write to enable an application. The same discomforting feeling that accompanies struts came upon me. Man, brands can be strong.
A very nice evening followed. I was happy I came by bike.
Thursday
Headache a bit less splitting. Keynote about the RAD race. Got into the spotlights! And man, those nanos were close.
Then, over to the more serious stuff. Rod Johnson declaring that "Spring 2.0 is going to be even easier", and bragging about how they got Adrian Colyer to join Interface21. It looks like it will be interesting, indeed.
Romain Guy presented his blasting-away Swing demos. The only remark one can make here is that he should give the crowd some time to go "woowwwww".
Then again a shared session: JGoodies, which compared GUIs with whiteboards, and "Bitter JavaServer Faces", which seemed a warning about some design flaws is JSF, if anything.
A couple of sessions had already mentioned GlassFish, the reference implementation for J2EE 5. I hope the project is more interesting than the demonstration (Is anybody interested in seeing "ant build" report "Build succeeded"? I mean, on someone else's screen?)
Maven is a project I have a love-hate relationship with. I love to try it out, but I hate the way it forces me to do things its way. But I was getting pretty excited to give it another go, until the unfamous "If you remember only one thing..." slide appeared: "Maven 2.0 is ready. But expect bugs in it." Eh? I think those guys need to rethink their communication, or the timing of their announcements. For years we told people "OS beta is as good as commercial 1.0", and now we're saying "OS 2.0 is shaky at best"?
Then I entered the "Telnet" session (pun intended), only to receive a text message "feeling terribly sick, kids are doing awful things, please come home" 5 minutes later. So I did as any new man would do. King Kong will have to take a rain check.

During and between all that technical stuff, I had the chance to catch up with many people I like to catch up with. Most of them I see only once a year, but it's nice to see them nevertheless. Also saw people that I wanted to catch up with, but didn't get a chance to approach. Javapolis is really starting to get a crowd control problem. But drinks and food were better than last year, and a venue in the center of Flanders is a splendid location. Especially if you live there.

Posted by tomk at 09:44 PM | Comments (0) | TrackBack

One of Javapolis' most secretly kept secret...

... has just leaked at JavaLobby! Not convinced? Recognize this guy?

Probably only the Flemish (and some Dutch?) people will recognize him - but nevertheless...

Posted by tomk at 12:06 PM | Comments (1) | TrackBack

December 05, 2005

JavaPolis RAD Race

The world moves in mysterious ways. A few months ago, some Javapolis member asked me "we're planning on organising a RAD race during Javapolis, would you participate in such an event?" I said "hell no, I've grown too old for that kind of games." But the RAD race was organized anyway. And my dear collegue can be very convincing. So now I'm trapped. Or how contact with youth keeps you young...

If you want to challenge us: there are still (again?) 2 slots open. Non-participants are not allowed to mock.

Posted by tomk at 10:32 PM | Comments (1) | TrackBack

November 29, 2005

Pirates and terrorists

Frank:

There's just no point in buying the crap any longer, you're only encouraging them.

Damn right. I used to buy a cd per week. Now I'm down to one per year - and it's usually not for myself.

Posted by tomk at 09:06 PM | Comments (0) | TrackBack

September 30, 2005

JUnit

LOL. This argument falls in the same category as "a hammer isn't a tool, because I've seen people using it as a weapon". Or how "definition purism" is pretty almost always useless. And always boring.

Posted by tomk at 08:56 AM | Comments (1) | TrackBack

September 26, 2005

Unit testing an array of input data

This one is interesting, I think. Suppose I have an array (or Collection) of test input data. I want to test the same Java method for each of those entries. But, when one fails, I want to continue testing, not halt the whole process. How do I go on with this?

  • If I create a testMyMethodX() for every case (with X a number), I do a lot of useless typing.
  • If, on the other hand, I loop through the array "by hand", the first test that fails will stop all other tests to run.

So, has anybody else encountered this? Did you find a solution? Do you want to share it?

Posted by tomk at 01:52 PM | Comments (2)

September 21, 2005

BeJUG OSS libraries seminar

As mentioned before, I gave a presentation on Jakarta Commons yesterday for the Belgian Java User Group, aka BeJUG. It was a nice experience. Here's a picture of me giving my best impression of "will the lot of you sit down so that I can get this show started"-look. Not my best angle, I might add ;-)

I heard that the .ppt and even an audio feed will be made available later. I'll keep you posted.

Update: The presentation is available here. Audio feed still to come.

Update: Audio feed available here. (You'll probably have to login. Free registration.)

Posted by tomk at 09:42 AM | Comments (2) | TrackBack

September 19, 2005

Weird exceptions

I once encountered this one, too. Talking to the guy who wrote it, he said "it was known to be faster, and even recommended by Sun itself". End of conversation, of course. I tend to agree with the statement I read some time ago: "'best practices' considered harmful" (or something similar) (extra brownie points for who can get me the right link).

PS: The guy's contract was not prolonged.

Update: Joseph gets the brownies: this is the article I was referring to. Thank you, Joseph.

Posted by tomk at 03:55 PM | Comments (2) | TrackBack

August 29, 2005

Eerste Java versie

Oh, en wat ik gevonden heb: ik kan al zeker zeggen dat ik met Java werk sinds jdk 1.1.5. Ik dacht ooit 1.1.3 ook geinstalleerd te hebben, maar daar vind ik niet zo direct harde bewijzen voor.

Posted by tomk at 10:37 AM | Comments (0) | TrackBack

August 25, 2005

SSL on login pages?

Kasia is doing her oh-you-morons thing again. But she might just be wrong here: SSL is not only for encryption, it is also used for authentication. The server needs a certificate that is provided by a trusted (by the user) Certificate Authority, yada yada... (you know this stuff). While I think that phishing is done in more subtle (and thus easier) ways than DNS-hijacking, the authentication in itself should not be seen as "a waste of CPU cycles".

Maybe it's a flaw in the https-model, where encryption and authentication can't be separated (as opposed to encryption and authentication in the email world: you can do each individually, or both at once). That doesn't necessarily mean that the designers of https were clueless.

Posted by tomk at 10:02 AM | Comments (1) | TrackBack

August 24, 2005

BeJUG

It's official: I'll be speaking at the BeJUG Open Source Libraries Seminar. You're all invited to come :-)

Posted by tomk at 11:31 AM | Comments (0) | TrackBack

August 22, 2005

Documenting

Glen finds out about the documentation problem. The questions he poses seem to be quite right, but imagine the programmer writing that line. She is busy keeping 15 threads on various levels in her head, and then she has to write a comment for a method. At that moment, her head is already full, and she really isn't capable of starting to imagine which alternatives are possible for another reader.

Another way of expressing myself: when writing code, everything seems to be pretty obvious to you. You expect everybody to understand the same thing, especially for trivial getter methods like this one. Why bother trying to guess a reader's context?

Of course, that "triviality" almost always bites somebody, and most of the time, it is the programmer herself. It always comes as a surprise if you have to read your own code a couple of months later: "When writing that comment, I clearly remember thinking 'this is so damn obvious', but, man, what does the damn thing do?"

Posted by tomk at 09:13 AM | Comments (0) | TrackBack

August 19, 2005

Buzzwords (2)

Another problem I have with buzzwords is that everybody (and I mean that literally) understands something different with them. It is quite confusing to talk with somebody about "Visitor", when she really means (in my eyes) "Chain Of Command".

  • And why exactly would you use Visitor?
  • Well, it fits quite naturally here
  • No, it doesn't, we don't have a tree to walk through here
  • No, but we do have a set of solutions to walk through
  • So you mean "Chain Of Command", then?
  • No, we don't have a Command interface, only a Visitor interface
  • <continue at the top>

So far for the shortness of communication...

Posted by tomk at 11:08 AM | Comments (0) | TrackBack

Wi-Fi at McDonald's

I'm sure I will regret this, but ...

This seems to be a fairly weird opinion for somebody who calls himself "columnist". Striking quote: "The day is coming when travellers will either get free internet access at your restaurant or they’ll be looking for a restaurant down the road where it is free." Sure. But that day isn't here yet, and until that day, McDonald's can make a profit on the _extra_ service it's providing. It's not like the motel owner charging you for TV, but the motel owner charging you for room service. And he can continue to do that until the motel down the street offers free room service, or even longer if that other motel doesn't offer clean sheets.

Don't get me wrong: I would like to have wifi for free too. But I don't think getting wifi with your hamburger is a human right.

Posted by tomk at 08:21 AM | Comments (2) | TrackBack

August 01, 2005

Cocoon Gettogether

Bertrand announces the annual Cocoon Gettogether. The location has changed, so I guess Steven will not be the single organizing force anymore. It will be interesting to see the side-by-side comparisons between Amsterdam and Ghent ;-)

Posted by tomk at 11:19 AM | Comments (0) | TrackBack

July 29, 2005

Buzzwords

I just stumbled on this article (people reading this blog, will understand why these things jump to my eye). I was quite amazed by the Jared's opinion:

  • on spring:
    Give brownie points on keywords like IoC, DI, etc. etc.
  • on design problems:
    Here, buzzwords like Singleton, encapsulation etc. will fly out anywhere and if the candidate really knows what he/she's talking about, smile.

Usually, when I hear people spawning buzzwords, my bullshit-o-meter goes all the way into the red. The fact that a candidate has read the spring homepage, doesn't tell me much about this experience with the framework. Of course, keeping score like this is a very handy trick for hiring managers who are a bit uncertain about the technical domain they're interviewing about.

I'm afraid I wouldn't pass Jared's interview. My reaction to buzzwords is to avoid them. Moreover, some of his concerns (Have you ever used a Singleton!) come so naturally to me, that I wouldn't even consider it to be a "design achievement".

I'm afraid interviewing is an art, not a list of questions.

Via Erik.

Posted by tomk at 10:13 AM | Comments (1) | TrackBack

July 28, 2005

Google idea: timezones

Everybody knows the Google calculator, right? You go to Google, enter "2+2", and get "2 + 2 = 4".

Now, most people will also know the Google converter: enter "101f in c", and you'll get "101 degrees Fahrenheit = 38.3333333 degrees Celsius".

So far, so good. But when I was reading about the Google Code Jam 2005, I was considering whether I would participate, just to see how far I would get. But - will I have time at 9 PM EDT? Wouldn't I be at work? So it came quite naturally to me to go to Google, and enter "9:00 pm edt in cet". Big disappointment: I thought of something that Google didn't. So, Google, is this an idea for you? Can you do this?

Posted by tomk at 12:01 PM | Comments (0) | TrackBack

July 20, 2005

Ant, 5 years ago

Stefan is a bit harsh on himself:

Luckily Conor took over for Ant 1.2 and things became more organized.

I remember those days, and I also remember that Stefan's enthusiasm was the main driving force behind Ant's development. So thank you Stefan, for a great build tool!

Posted by tomk at 09:11 AM | Comments (0) | TrackBack

July 19, 2005

Log4j tracing

I write this a lot:

logger.debug("varName: "+varName);

Starting to think about this, would there be a way to have log4j handle this for you? So you could just write something like

logger.debugVar(varName);

and it would give the same result as above. It seems pretty hard (the variable name is not passed through the method call), but if anybody has an idea for this: shoot!

Posted by tomk at 02:52 PM | Comments (9) | TrackBack

July 15, 2005

log4j default configuration

In case anybody involved in log4j should read this: +1. This is the main reason I still use System.out.println() sometimes.

Posted by tomk at 02:44 PM | Comments (0) | TrackBack

June 29, 2005

Eclipse keyboard cycling

Did you ever experience the weird phenomenon that, while coding away in Eclipse, all of a sudden your keyboard layout was changed? Your a's became q's, and your z's became w's. This always happened to me when I was pressing some complicated key combination, and got confused, and had to start over (alt-shift-R is complicated, in my book). The really weird thing was that all other programs would still react normally to the keyboard, except for Eclipse. The only remedy I knew of, was to restart Eclipse.

And 2 minutes ago, I found the other solution: alt-shift. This seems to cycle between keyboards within your application. A quick test shows that this is also the case in Firefox - I just never experienced it there, because the most complicated shortcut I use in Firefox is F6.

Another tiny mistery unraveled.

Posted by tomk at 09:55 AM | Comments (1)

June 23, 2005

Web standards

Eat this, Zeldman:

Just a quick summary: in real world situations, designing with web standards has verly little advantages for people with physical disabilities. And in some situations, it might even impede accessibility.

Via Michel.

Posted by tomk at 09:59 AM | Comments (0) | TrackBack

June 09, 2005

Netbeans form designer

Impressive demo of NetBeans' upcoming form designer. I'm curious of the real-life experience will be as impressive.

Posted by tomk at 09:01 PM | Comments (0) | TrackBack

May 19, 2005

Buggy dates in Java

That the Date and Calendar classes in Java are hard to work with, that's a fact we're all familiar with. But today, I bumped into something that seriously looks like a bug to me.

Consider the following lines of code:

Date date = new GregorianCalendar(2002, Calendar.DECEMBER, 30).getTime();
DateFormat format = new SimpleDateFormat("yyyyww");
format.getCalendar().setFirstDayOfWeek(Calendar.MONDAY);
format.getCalendar().setMinimalDaysInFirstWeek(4);
System.out.println(format.format(date));

Now, what's the output you would expect from this? My first guess would be "200252" or maybe even "200253". But when you start thinking about it, you start to wonder to which year a week really belongs to. So maybe even "200301" wouldn't surprise you too much.

But the proof of the pudding is in the eating, so you run the program. And your jaw drops to the ground when you see the output:

200201

Huh? How can December 30 possibly be in the first week of the year? After some googling, surfing, studying the sun and the stars, and reading all about standards, legislation, and ISO 8601, you get the feeling: I found a bug!

So one goes to java.sun.com's bug database, and checks for the bug's existence. And what does one find? This. So the bug has been reported, and has been dismissed as "not a bug". But I really don't understand the reviewer's explanation: how can a day in December be in the first week of the year?

Now, I found a workaround using Jodatime, which goes as follows:

Date date = new GregorianCalendar(2002, Calendar.DECEMBER, 30).getTime();
DateTimeFormatter fmt = ISODateTimeFormat.weekyearWeek();
String result = fmt.print(new DateMidnight(date)).replaceAll("-W", "");
System.out.println(result);

Which showed me the result I ended up expecting:

200301

But still, if anybody could shed some light on the JDK's behaviour, I would greatly appreciate it. My intellectual curiosity just isn't satisfied.

Posted by tomk at 10:17 PM | Comments (4)

May 09, 2005

The Java dilemma

What would you prefer: to re-invent the wheel, or to add a "dependency" to your project? My choice is easily made...

Hint: I like code that is tested by more than one person.

Posted by tomk at 09:09 AM | Comments (4) | TrackBack

April 12, 2005

Where's the domain?

Koz Speaks: Where's the Domain?

While I fully understand the pledge for a more active object model, I've found myself backing away from it lately, too. The problem is that many objects seem to have so many roles, and are used to perform so many operations, that it just becomes unfeasible to put all those methods in one class. For example, you have a tree you want to have all leaves of. Ah, call Node.getChildren() recursively, you say. And when the node at hand is a leaf, it returns itself. But: sometimes I want all the leaves. Sometimes I only want the leaves of certain branches. And sometimes, I don't only want the leaves, I want the internal nodes too. What's one supposed to do? Implement Node.getChildren(), Node.getChildrenOnCondition(Condition), and Node.getChildrenIncludingInternalNodes()? Or get some hefty Visitors, and have those "external" classes decide which logic to use? Which object model will look cleanest, do you think?

I'm all for the naked objects approach, but I'm having trouble to keep all the "aspects" of an object cleanly separated.

Writing that last sentence, makes me wonder of the word "aspects" there is the same as the word "aspect" in "AOP". Stuff to ponder ...

Posted by tomk at 01:40 PM | Comments (1) | TrackBack

April 09, 2005

Choose your information carefully

I've been struggling with a legacy application for a while now. It has all this bloated and non-OO-minded code in it, that I wonder: "What was this architect thinking?" In order to get some "guru insight" in the problem, I bought "Core J2EE Patterns" (Deepak Alur, et al., Prentice Hall, 0-13-064884-1). I was hoping to get a solution to the problems at hand. I was just browsing it, when it hit me: the legacy app we're dealing with, is following exactly the methods described in this book. It is great if you have a can of non-thinking Java-typers, to whom you can say "type me 500 lines of code by tomorrow, and if I want to refactor something, you'll be present again". But it doesn't work if you have a small team of (more or less) intelligent people, who want to get something done, instead of mindless typing.

On second thought, the problem most likely is the underlying J2EE (and, more specifically, all that EJB stuff) architecture that's causing trouble. You can't build a good house if your fundamentals are weak.

Just for fun, another unedited draft, from March 14, 2003. I still didn't quite finish that book.

Posted by tomk at 01:46 PM | Comments (0) | TrackBack

April 06, 2005

Ruby vs Rails

Comparisons like this give me the creeps. It just doesn't make any sense: what is "language", and what is "library"? For instance, I once saw such a comparison between Python and Java. The Python program was using something like HTTP:: (forgot the right syntax), while the Java counterpart implemented the http get by itself. Using commons-httpclient would have reduced the lines of code tremendously.

Anyway, I suppose people are still looking for useful metrics in the programming world. Not an easy job, but I thought that we all already agreed that "LOC" is not a very good one.

Via Shinzui.

Posted by tomk at 09:28 AM | Comments (1) | TrackBack

February 25, 2005

Software engineer wanted in Gent

Software engineer wanted. If you're graduating this year, check it out. I can definitely recommend these people as bosses for your first job.

Posted by tomk at 04:37 PM | Comments (0) | TrackBack

Dynamic layout

Nice feature in Swing: Dynamic layout.

Posted by tomk at 01:47 PM | TrackBack

January 31, 2005

Struts (part II)

Just after my wave of nostalgia, I find: "Struts gets mothballed". Everybody goes forward!

Via Erik.

Posted by tomk at 10:14 AM | TrackBack

January 27, 2005

Struts bashing

Funny.

It still amazes me how condemning people are on struts nowadays though, when it was the first framework that at least did an effort to ease the way for web application development. I've just programmed a *servlet*, and I wouldn't go back programming forms with that.

I think this makes me understand better how people are still going wild about the Beatles -- they seem to think the Beatles are ultra-revolutionary, but to me, they are old stuff. But I guess they were indeed revolutionary in their days. It's the same for struts: for me, struts was an astonishing step forward in web development, but for others, it seems to be something antique. They have never known the era before struts, or they just forgot.

Boy, am I getting old.

Via Howard.

Posted by tomk at 09:25 AM | Comments (4) | TrackBack

January 12, 2005

Java Tip #6

FutureTask: Java Tip #5 - Avoid 64KB method limit on JSP gives me inspiration for Java Tip #6:

Avoid JSP

There are enough alternatives.

No idea why I felt the need to write this down.

Credits to Erik

Posted by tomk at 02:53 PM | TrackBack

December 23, 2004

Continuations

... finally start to make sense. I've heard a lot of buzz about them, but only now I start to understand them a bit.

One question that remains: why store "what will follow" under some key, instead of storing "what has been" under a key? Wouldn't it be easier to claim "this page id means that this user has done that and that and that, and these request parameters indicate that he will now go there". The net effect will be the same, I think, but the abstraction wouldn't leak that much (to the programmer, that is).

Let's try to restate that: instead of changing objects in a session when receiving a HTTP request, you take a copy of those objects (leaving the originals as they were), and start working on the copy. You can do the same actions that you would normally perform on the original objects. There's only one difference: the original objects are now stored in a repository under a page-specific ID. When the user has cloned her window (or pressed the back button, or...), you can fetch those objects again (thus going back to the state she was), and continue from there. In my gutt feeling, this would reduce the amount of continuation-specific code (sendPageAndWait() - huh?), including the JavaScript-flow enabling dependency.

I think I have to re-read the article, seems like I have missed something. If you can explain me what I've missed, I will be very grateful.

Posted by tomk at 04:14 PM | Comments (1) | TrackBack

December 17, 2004

NDoclet

Erik pointed me to NDoclet, a MSDN-style Javadoc doclet. The MSDN style seems a bit weird to somebody who's used to look things up the Sun way, but it sure looks clean. You can view the result of my little experiment here, and compare it to the more traditional approach.

Posted by tomk at 10:49 PM | TrackBack

November 23, 2004

Gmail FS on Java?

Today, I ended up here (via Markus). This triggered a whole row of associations, including the GMail Filesystem. It looks like Commons VFS could be used to build a Java-mountable GMail filesystem. Any takers?

Posted by tomk at 03:10 PM | Comments (0) | TrackBack

Wanted: Developers

Look here. Notice anything special? No? Let me tell you: 25 links posted on that beat, and 2 of them about people looking for people to work with them. In good ol' US of A, even.

Let me increment the fun: "we" are looking too. In Belgium, but that shouldn't stop the Belgians ;) I've been asked if I know people that would be interested. I have a sneaking suspicion that some of the people I've met and worked with in the past are, but none of them jump to mind at the moment. It might be that some are reading my blog (one can dream, can't he?), so here it goes. Contact me if you want details, or if you would like me to recommend you.

If you don't belong in my past, you're of course more than welcome to belong in my future.

Posted by tomk at 02:27 PM | Comments (0) | TrackBack

Eclipse tips&tricks

This looks like an interesting list of Eclipse tips&tricks.

Posted by tomk at 09:57 AM | TrackBack

November 08, 2004

Eclipse Tips&Tricks

This looks like a nice collection of Eclipse tips&tricks... The XP look-and-feel works for me.

Via mindstorm

Posted by tomk at 10:04 AM | TrackBack

October 10, 2004

"Open source solves everything"

Andy thinks he has found another reason why Sun should open source Java. If that's really true, how come I just stumbled yesterday on a bug in XDoclet that has been reported almost a year ago? As much as I would like it, open sourcing stuff is not the silver bullet to get rid of bugs.

Posted by tomk at 12:22 AM | Comments (0) | TrackBack

October 09, 2004

J2SE 5.0

It's not beta anymore? And nobody told me about it... except Markus.

I get more and more the feeling that it all doesn't matter that much: Java 5 won't be "out" until WebSphere and the like will support it.

maybe I'm just getting too old for this shit...
There used to be a time when I knew months on beforehand the exact date of the release of a new JDK.

Posted by tomk at 11:33 PM | Comments (0) | TrackBack

October 04, 2004

JBoss IDE

The first time I'm the JBoss people grateful for anything: JBoss IDE: a plugin for Eclipse that, amongs others, provides autocompletion for XDoclet tags for Hibernate. Hmm, looks like my chain of tools is becoming quite lengthy now...

Posted by tomk at 02:22 PM | Comments (0) | TrackBack

September 09, 2004

How to migrate to Eclipse from ...

IBM has posted a series of articles for those shy people that aren't ready to learn a new IDE hands-on (duh):

How reading such large amounts of text will persuade you to use Eclipse, is beyond me (especially if you already actually tried Eclipse once), but if it does: good for you!

Via Erik

Posted by tomk at 05:01 PM | Comments (4) | TrackBack

September 03, 2004

Definition purism creep

I respect Martin Fowler. I really do. But blog entries like this one make me ask this question: "what the hell are you doing?" If you make a change to a program, is it really that important to call it "optimization" or "refactoring"? Things like this are generally the result of too much belly-staring: nobody gives a shit, but you think you're pondering the Most Important Question in Life. There are more useful things to think about.

Oh, I can think of one occasion when this might be important: you're manager has read a book about XP, and wants to be hip and implements XP, but asks you to categorize the work in your timesheets between "optimization" and "refactoring". In this case, try to talk some sense into the guy. Or run, run like you've never run before.

Posted by tomk at 09:49 AM | Comments (0) | TrackBack

August 26, 2004

Sing an applet!

I just stumbled on this page. Great! Yep, learning the answers to those questions by heart will most certainly help you to ace your next interview.

The hardest one seems to be question #68. But my favorite is #99:

How do you sing an Applet?

Dunno. C minor?

Posted by tomk at 11:16 AM | Comments (1) | TrackBack

August 20, 2004

Duke screensaver

I've been looking for this a while ago: a Duke screensaver (via Simon). I can't imagine it's the only one out there, but it's the only one I've found so far.

Posted by tomk at 01:22 PM | Comments (0) | TrackBack

July 20, 2004

History keeps repeating itself

I'm not talking about this, but about a cvs web client (web cvs client?). Another employer, same task at hand. I didn't really finish the task last year, but I'll have to manage this time.

I spent the day looking at and trying to install ViewCVS. I think I'm almost there, but there seem to be a few things missing (read: I don't get a 404 anymore, just a blank page).

What I don't like so far? The fact that you have to run the webserver on the same machine as the CVS repository, is one issue. The fact that every goddamn configuration string is unix-based, another one (yes, we're running CVSNT as a server).

My dream? A nice servlet/jsp/anything else Java-based (we're a Java shop), that you can just drop in tomcat/webapps, and that you configure by entering your CVSROOT.

Well, we're not there yet. Going back to the world of PYTHONPATH and its friends.

Posted by tomk at 04:40 PM | Comments (3) | TrackBack

July 14, 2004

Making fun of Java

Trackback works! The other day, I referenced Scott's reference to Inside Jack. And this morning, I get an email from him pointing me to his reference to Totally Gridbag. Which I'm now referencing here. Bittersweet recognition.

Confused? Just click here, for &divinity;'s sake.

Posted by tomk at 09:28 AM | Comments (0) | TrackBack

June 04, 2004

System properties

This article about System.getProperty (via Erik)blew me away. I was utterly convinced that System.getProperty() gave me everything I've set in my environment, that I had to try it out. And I was quite baffled to see that the author was right.

However, his proposed solution threw a "java.lang.IllegalArgumentException: Malformed \uxxxx encoding." on my Windows XP machine.

Posted by tomk at 10:24 AM | Comments (4) | TrackBack

May 28, 2004

Styled text in Swing

Just discovered (although it feels that I may have known this before, I've just forgotten about it): how to get colors in your Swing components? Just treat your strings as HTML!

new JTree(new String[]{"<html><font color='red'>O</font><font color='blue'>n</font><font color='green'>e</font></html>", "Two"});

gives you

Now ain't that beautiful ?

Posted by tomk at 04:24 PM | Comments (1) | TrackBack

April 28, 2004

JNN

I've just peeked into the code of jnn: The Juicy News Network, a weekend project by he who some call God (I won't mention any names though). And again, I'm worried.

For ten years now, people keep saying "In Java, variables start with a lower case letter." James Gosling sometimes uses capitals. "Structure your code." James doesn't even bother to hit the <enter> key an extra time between methods. "Use high-level constructs" I see bit manipulation all throughout. "Separate concerns" And why shouldn't Mr. Gosling makes his Feeds classes aware of the fact that they belong to a GUI, and thus have arrangements made for events?

It look like a new truth that I've just heard recently: "When coding, everybody falls back to his level of comfort." When you're used to Java, you'll program in Java following all those nifty design patterns and coding practices. When you're used to databases, you'll program in stored procedures. And I guess that, when you invented Java, your level of comfort is not Java, but more like C/C++.

What worries me most, though, is that it just works. Maybe there is a lesson to be learnt here.

Posted by tomk at 01:02 AM | TrackBack

April 22, 2004

Naive security

If you believe one word from this article, you might be in deep trouble.

Make methods private as security measure? Ever used reflection?

public class Reflect { private static String indent = " "; private static String demarcation = "======="; private Reflect() { } public static void dumpAllMethods(Class clazz) { Class curr = clazz; while (curr != null) { dumpDeclaredMethods(curr); curr = curr.getSuperclass(); } } public static void dumpDeclaredMethods(Class clazz) { dumpArray("Declared methods", clazz, clazz.getDeclaredMethods()); } public static void dumpMethods(Class clazz) { dumpArray("Methods", clazz, clazz.getMethods()); } public static void dumpConstructors(Class clazz) { dumpArray("Constructors", clazz, clazz.getConstructors()); } private static void dumpArray(String subject, Class clazz, Object[] array) { System.out.println(demarcation + " " + subject + " for " + clazz + " " + demarcation); for (int i = 0, n = array.length; i < n; i++) { System.out.println(indent + array[i].toString()); } System.out.println(demarcation + " End " + subject + " dump " + demarcation); } }

Et voila, all methods accesible to you.

Make jars sealed? Ever heard of WinZip? Do you remember crimson in it's beginning days? If you wanted to use another XML parser (or was it XSLT engine), it was standard and well-known practice to unseal the crimson.jar.

I hope these people aren't going to secure my application.

Posted by tomk at 07:42 PM | Comments (5) | TrackBack

April 20, 2004

"Flaws" in open source

Hear, hear. Most OSS developers develop for fun. If this ain't what you're looking for, go look somewhere else. And try to understand the above sentence: we develop for the fun of developing. Just like you collect stamps for the fun of collecting. Or do you want to tell me that you want to earn money with that?

Posted by tomk at 10:17 AM | Comments (1) | TrackBack

April 16, 2004

EJB vs Hibernate

The world has become a weird place: during last JavaPolis, I heard Floyd Marinescu say "Alternatives to EJB are rising. They might be a better solution for you." Today, I read Gavin King saying "EJB's are not that bad after all." What's next? World peace?

Posted by tomk at 09:31 AM | Comments (5) | TrackBack

April 14, 2004

March 20, 2004

Groovy and the JCP

Cathing up on Erik's linkblog, I noticed all the bickering about Groovy submitting to the JCP. Not having an opinion on the subject (other than: "Eh? How is Groovy an extension to Java?"), I wondered why nobody noticed what this really meant: Groovy considers the JCP to be a valid body to submit to. After all the bickering about how the JCP sucks, it struck me that such a guerillia movement is complying to it.

And the second after I had that thought, I saw Brian's comment, reminding me that I'm not that uniquely clever as I often think I am.

Posted by tomk at 11:49 PM | Comments (1) | TrackBack

March 19, 2004

Java frameworks for web development

Manageability - What is the best Java framework for Web development? Seems about right to me. I've used 2 of the three most popular ones, and am currently learning to use the third one. Ergo: in the near future, I'll know which is _the_ best one. I'll get back to you.

Posted by tomk at 09:33 AM | Comments (6) | TrackBack

February 18, 2004

Open source Java?

Recently, blogland is (again) uproared by the question "Should Java be open source?". I just read another opinion, this time by somebody I respect highly. But I don't agree with him. Reason enough to give my opinion, I guess.

For starters: Eric Raymond's argument (as it is described by Bertrand, I didn't read his article) isn't valid at all. I think MS Windows is pretty ubiquitous, yet you can't describe it as 'uncontrolled'. A single example doesn't prove anything. Blame my scientifical mind for contesting this.

Secondly, I'm not convinced that OS Java would be a good idea. The first thing that will happen, is forking all around. Every "Java" will have its own pros and cons (This one has untyped variables! This one has closures!), and programmers will have their own "Java" of choice. Leaving the user with having to download a new "Java" for every program they use. Is moaning and grinding about jar dependencies familiar to you? Imagine that it becomes moaning and grinding about "Java" dependencies. Or jars that are not available for certain "Java" forks.

Maybe Sun's marketing machine isn't up to par with Microsoft's, and I can regret that. But thinking that setting Java free will solve this problem, is naive at least. A lion that has spent his life in a Zoo won't survive in the wild.

As much as I would like a Java you can tinker with, I'm too comfortable with the idea of having a Java, instead of having tons of "Java"s. If you want functionality that's not readily available, extend, don't replace. Java is perfect for that.

After all, remember the effort we had to make to finally have web standards.

Posted by tomk at 09:16