java

Raible's Ajax and Spring Presentation

Tagged:  

If you're a Java programmer and interested in adding sexy Ajax goodness to your apps, a good starting point is Matt Raible's presentations, which he has made available for download for those of us who can't actually go see him talk.

update: The pdf presentation I downloaded actually doesn't seem that useful on its own, it doesn't contain as much information as I'd hoped. Most of the slides are just Matt's photos, that I assume illustrate personal ancecdotes that he uses to make points about the topic, but are kind of baffling on their own. I think the equinox-ajax.zip file probably contains code examples, but in the past when I've downloaded Matt's appfuse framework starter kit I couldn't really get into it, and I believe equinox is a version of that. Bram Smeets intro to using DWR may be a better start.

Another source checker

Tagged:  

Grooming your code

The Jakarta General list has been yakking about PMD, a tool that scans Java source for problems like unused local variables and parameters, empty blocks (if statements, catch blocks, etc), unused private methods and so on.

I ran it on some of the code libraries from Wild5, which I consider to be crusty old stuff, but it came out pretty clean, other than a couple blocks of duplicate code between superclasses and subclasses. Of course I didn't run it on some of the hairier packages .... I also tried it on a chunk of the Catalina source code, but there was too much. Better to run it on subpackages, I guess.

PMD runs standalone, or as a plugin for JEdit, JBuilder, Eclipse, and Emacs. Worth a look. No documentation, although it's fairly easy to figure out.

Peter Donald suggests that checkstyle is more mature.

JPublish 2.0

Tagged:  

I'm a bit slow on this one, but Anthony Eden has reacted to some of my earlier comments on JPublish by publicly mulling over his plans for 2.0. He's going to come up with an architecture for storage, something it lacks now, and hopefully a way to get content into the system. He's also thinking about what modules it needs.

JPublish's model for finding data, templates, and meta-data is very nice, but there are no tools for entering any of these things, other than by plopping them into the file system. That's the best way to manage data as files, since there are plenty of tools available. But for those who want to keep a lot of content in a database, we need some tools to manage that content.

One thing that will be interesting to see is whether Anthony moves over to a JPublish-based blog package at some point. He's a big booster of Roller, which looks like it is on the way to becoming a primo Java blogging package, but JPublish would be a good platform to build a blog/wiki/forum type thing on top of, something like what Russell has been talking about. Of course Roller is here now and rapidly being improved by a community, and I haven't seen any momentum for building something like it on JPublish, so I guess it's a wheel thing.

One thing Anthony mentioned as a goal for JPublish 2.0 is:

In general I am going to try to factor out as many of my own components as possible and start using other peoples components so that I can focus on items which are really important in JPublish such as the repository system.

This is one of the reasons I decided* not to use Cofax: it implements its own database persistence, templating, and pretty much everything else, and IMO spreading development effort over so much shows in that each of these is mediocre when compared with components available off the shelf, such as Velocity, OJB, WebWerk, etc. There are some things I like about Cofax, in particular the way it finds page templates is brilliantly flexible. But I decided that refactoring Cofax's framework to implement standard components would be more work than reimplementing its clever bits on another framework.

(* Back when I was looking to get into CMS consulting, which it doesn't look like I'll be doing after all)

java.blog

This branch of my site is now officially a Java Blog, with a listing on Mike "The Rebelutionary"'s list of Java-oriented blogs. It's kind of weird to see kief.com listed as a blog - I've had this site for five years, and it was never a blog, just a few stale pages where my family could see what I was up to 9 months ago. Once I set up Movable Type to manage the pages, I just fell into blogging, and now there are actually a handful of people reading the site and linking it from other sites. Cool!

Of course I don't consider this to be a pure Java blog, Java is just one of the things I'm into. But if the multi-blogger is a Java Blogger, why not me?

Thanks Mike! I'm putting the new java.blog button in my sidebar - btw Mike, where's yours? ;)

Tomcat, tempdir

Tagged:  

Finally found the cause of the problem I was having with Tomcat, and it was a bitch to find. Basically, I was missing a directory named "temp" in the CATALINA_BASE directory. Usually this is caused by unzipping the Tomcat distribution with an unzipper which doesn't create empty directories, which apparently WinZip doesn't. This actually wasn't my case, I'm building the web site home with Ant, but my source copy of the website didn't have the temp directory, so it was the same problem.

Searching on the exceptions involved turned up lots of irrelevant stuff, but I finally turned up a thread on the Tomcat-Users mailing list which tipped me off. For the record (and Google), here's the stack trace I was getting:

2002-09-03 14:40:59 ContextConfig[/docs]: Scanning JAR at resource path \n '/WEB-INF/lib/neat_friends.jar'
2002-09-03 14:40:59 ContextConfig[/docs] Exception processing JAR at \n resource path /WEB-INF/lib/neat_friends.jar
javax.servlet.ServletException: Exception processing JAR at resource path \n /WEB-INF/lib/neat_friends.jar \n at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:936)
...

----- Root Cause -----
java.io.IOException: The system cannot find the path specified
at java.io.Win32FileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1162)
at java.io.File.createTempFile(File.java:1247)
at java.io.File.createTempFile(File.java:1284)
at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:143)
...

Keywords: Tomcat 4, scanning jar, jar file does exist! WTF!?!?

New JavaBoutique Article

Yay, my new article is up on JavaBoutique. This one is about writing servlet filters, kind of an introductory-level topic, but I don't think filters are exploited enough. They're essentially Java server plugins, if you write a filter it can be used on any standards compliant Java server.

Last month I wrote an article on how to configure Ant build files for multi-developer projects, particularly projects you want to manage with CVS. Next I'd like to do an article on Jakarta's Digester, which is a really clever package for making a configuration system for pluggable components. It uses Beanutils for painless introspection, another tool that deserves wider awareness.

The Java Gap

Tagged:  

Rebelutionary's reaction to Russell's choice to use Struts rather than WebWork, because of the CV value, struck a chord with me. I thought something similar when I read it. There is a gap in the Java world, between the JSR standards issued by Sun and the best practice tools coming especially out of the open source movement, and if it continues to grow there will be two totally different skillsets - the EJB, JSP, JSR XYZ programmers and the Velocity, WebWork, JFoo programmers.

The problem is that Sun is in a frenzy to make sure there are Java standards to cover everything under the, err, sun, so they're turning out a lot of garbage standards. Meanwhile the open source community is cranking out their own solutions developed from experience in the trenches, and these are increasingly diverging from the party line. JSP sucks, EJB is generally unnecessary, the Sun logging standard totally ignores the battle-tested log4j, and the list is growing.

The split is not total. The Jakarta project lives in the gap between, for every Jakarta log4j which is ignored by the CSR there is a Jakarta Struts, which is evolving into Sun canon. Of course it helps that Struts' McClanahan is a prominent engineer at Sun, while Log4j's Ceki is not.

For us developers it's a difficult line to walk. In the ideal world we would use the best technology, and employers wouldn't have a problem with it. But I've had the experience of hedging when asked whether I know EJB - "Yeah, I've played with it, but I've never had a real-world project where it was necessary." You and I may know that 99% of projects that use EJB app servers don't really need EJB, and would be better off without it, but to an IT manager looking for a contractor that answer sounds like it comes from a bedroom hacker with no "real" skills. Then I go on to explain why I use Velocity rather than JSP.

It's nice to think that Mike is right when he dismisses employers who would choose people based on buzzword compliance, but he works for a small company which sees the benefit of solid software over Sun-certified garbage. But many big companies use the stuff with the official seal.

It's worse in countries like Turkey, and perhaps somewhat in Spain also. Small, progressive software companies are hard to find, the only companies which can pay a decent wage are big corporates; banks, telecomms, insurance companies, etc. In developing countries companies want to use Big Name Software from IBM, Microsoft, and Sun for the same reason people go out to McDonalds and smoke Marlboros - because that's what the rich kids use. They don't want free hand-me-downs or local brand cigarettes, because that's what the poor folks use.

I wonder whether the two sides will continue to diverge, or whether they will play off each other and revolve around a center of gravity which keeps them from spinning in totally different directions. My guess is in the long run better quality will feed back into the Sun process, albeit maybe in a watered down form, the way MVC turned into Struts.

Personally, I'll look for opportunities to work with clients who use EJB's and similar things, to get the CV material, but for my own projects I'm going with the stuff that works best.

Update: David "The Roller" Johnston is more understanding of Russell's choice than the Reb, suggesting a few more good reasons for going with the flow: "more books on the shelf, more trained developers, more momentum, and more chance of long term improvement". Of course there are many non-standard packages which are becoming mainstream, the best example being Ant, so it's not quite accurate of me to portray this as JSR vs. everything else.

JPublish 1.2 Out

Tagged:  

Anthony has released JPublish 1.2. I've played around with this, and written a module which is in the CVS repository but which I have let languish a bit. As I've mentioned before, I spent some time looking at CMS possibilities, and settled on JPublish.

I wouldn't really call JPublish a CMS, it's more like a CMS kernel, basically a simple, clean, well-architected web application framework. It uses Velocity for templating, and has a nice model for selecting page content, template, and meta-data based on the incoming path.

One thing it lacks is a good storage model. most of the components that come with it are file system based, which isn't going to scale well. There is database code, but it is based on hard-coded SQL, so if you want to add new objects to the framework, you're going to hard-code it.

I fantasize about building ObjectBridge support for it, and making it all more bean-based, probably using BeanUtils and Digester, but these would be a major change in architecture. And since it doesn't look like I'm going to be doing much CMS work after all, I'm not going to have anything like the cycles to commit.

Oh, well, it'll be interesting to see where JPublish goes, it has a lot of promise. I'm just waiting for someone to build a blogging package with it!

Syndicate content