Monthly Archives: June 2003

Slides From This Year’s JavaOne Sessions

The slides for this year’s JavaOne sessions are now available: JavaOne[sf2003] – Conference – Sessions You have to login with your usual name and password for Sun’s Java development area to be able to download them (which is free if you haven’t ever registered).
If you want to watch the presentations complete with recorded audio from the sessions you can apparently pay $100 to get that ability and a few other frills. But if you don’t feel like springing for that at least you can get the presentations for free.

A Comment On Prevayler vs. Database

There’s a really interesting debate on Prevayler vs. database usage for storing data going on over here at The Fishbowl: Prevayling Stupidity.
Lots of interesting points are made both for and against and when it is and isn’t appropriate to use an in-memory system like Prevayler, but one comment in particular stood out for me. It was this one:

And even if you have a dedicated machine, you have to wonder what happens if you’re providing some kind of service that gets really popular, really fast. Brad from Livejournal originally wrote the site to host him and a few friends. If he’d written it using Prevayler, it’d have fallen over the moment it got really popular, and today he wouldn’t be running a website with half a million users.

OK, now hidden in that statement is an instance of really bad design. I hope you see it but just in case you don’t, here’s what’s missing. Any application which is storing and retrieving data needs to have abstracted out all of that process into data access objects (DAO). Even if I’m writing something “for my friends” or “just for me” I assume nevertheless that I may someday change how I store and retrieve the data for my program. It may be something like a switch from database to Prevayler or from local storage to access via a web service to a remote server. Either way, because I’ve abstracted out the operations I need to perform I can write those quickly to get something which functions and then tune for performance later or completely replace the whole DAO implementation with another that simply implements the same interface.
So, take this to the bank, never never ever embed your data access in the rest of your application in such a way that you have to change any code in the meat of that application simply to replace something as simple as a persistence mechanism.

Sun Rolls Out New Site

Sun has rolled out their new site to act as a new collaboration/community spot for Java development.
Given that the organization of the development stuff on was never that good, this seems to hold some promise. For one thing they provide project hosting and they do it in ways that are different and sometimes better than Sourceforge. For example, you can have a wiki tied to every project and you can also have projects within projects (i.e. the JGoodies encompasses both Forms and Looks projects.
They also have a site wide wiki, weblogs, and several focus areas that concentrate on desktop applications, games, JXTA, etc. All in all, I think it’s pretty cool.

Long Overdue Emphasis On Games In Java

To me this is an absolute no-brainer. Sun makes play for games market | CNET
Sun has tried in the past to get some movement in the games market and failed outside of J2ME stuff on phones. Their last attempt gave birth to the site which I believe was a serious mistake. The site floundered around for a long time without accomplishing much and now exists only in the form of its forum section. They have promised a new site for some time without any visible progress. If Sun is really serious about gaming this time they will persevere and spend some money. They have no idea what it takes to build a large successful gaming development site, nor do they have a significant way to promote it. I know how to do both and it’s called
GDN has a built in audience of people to whom a Java gaming site could be promoted and more traffic than any other game development site in the world. Sun, you need to hire us to build and promote a new site for Java game development. You need to sit down with developers and find out what things are addressed in DirectX or Sprockets that are not addressed in the J2SE (e.g. if support for joystick, gamepads, and steering wheels is going to be sequestered off in the in the Java 3D API then the API needs to be expanded to become your new Java Games API so people know what to download and install). You need to provide examples that make it easy to get started building a wide variety of different games and you need to pay for articles and more sample code to jump start your market.
Remember, Microsoft struggled with the games market for a looonnngggg time before they got it right. They tried every hair brained thing under the sun including WinG and some pathetic wrappers over the Windows GDI before they brought out the first version of DirectX and they started to make headway. It doesn’t really matter that there have been some missteps in the Java arena, developers forget that stuff in a hurry if they find there are good reasons to develop for a platform. Lots of games would work as well under Java as they do at present under C++ because they don’t require screaming performance, not every game is Doom III so giving developers a chance to have their game on both the Mac and PC and easier portability to phones and handhelds will appeal to many of them. But not unless you get your message out in front of them, keep it out in front of them, and build a resource that they can turn to every day for news, code, support, etc.

Quick Graphics In Java

It’s tough to say whether this would work well for anyone other than the demo crowd but TinyPTC offers a simple way of quickly updating the graphics on your display, even if you are in a Java applet!
Be sure to check out the Java applet demos they have links to on the page. They all boast impressive performance.

Batik Creeps Towards 1.5 Release

After being horrifyingly quiet for a long time, the Batik SVG Toolkit has a new version. Beta 5 fixes bugs and adds features. One thing the documentation doesn’t really talk about much (at least anywhere I could find) is how to make use of its extensions for things like text wrapping. With SVG as it was originally there was no way to just wrap multiple lines of text within a space. That made some things that should be easy really, really, hard. That was because you had to figure out on your own where text was supposed to break due to font sizes, line widths, word breaks, etc. rather than leaving it to the rendering engine in your SVG renderer.

But Batik has extensions to add this and some other capabilities. So code that used to look like this:

<!-- Card Text -->
<text x="78" y="570" style="font-family:Times New Roman; font-size:27">
Threshold -- Mystic Zealot gets +1/+1</text>
<text x="78" y="600" style="font-family:Times New Roman; font-size:27">
and has flying. <tspan style="font-style:italic">(You have threshold as</tspan></text>
<text x="78" y="630" style="font-family:Times New Roman; font-size:27">
<tspan style="font-style:italic">long as seven or more cards are in your</tspan></text>
<text x="78" y="660" style="font-family:Times New Roman; font-size:27">
<tspan style="font-style:italic">graveyard.)</tspan></text>
<text x="78" y="700" style="font-family:Times New Roman; font-size:27; font-style:italic">
Nomad youths aspire to one of two roles in</text>
<text x="78" y="730" style="font-family:Times New Roman; font-size:27; font-style:italic">
the tribe: priest or warrior. Their secret</text>
<text x="78" y="760" style="font-family:Times New Roman; font-size:27; font-style:italic">
dream is to become both.</text>

can now look like this:

<!-- Card Text -->
<flowText font-size="27" font-family="Times New Roman" xml:space="preserve" xmlns="">
<rect x="68" y="540" width="480" height="258"/>
<flowPara>Threshold -- Mystic Zealot gets +1/+1 and has flying.
<flowSpan font-style="italic">(You have threshold as long as seven or more cards are in your graveyard.)</flowSpan></flowPara>
<flowPara top-margin="10" font-style="italic">Nomad youths aspire to one of two roles in the tribe: priest or warrior.
Their secret dream is to become both.</flowPara>

Now which one would you rather work with? Just be sure to start up the Squiggle SVG browser that comes with Batik using the command “java -jar extensions/batik-squiggle-ext.jar”. If you do you can run the flowText.svg and flowTextAlign.svg files in the samples/extensions directory and they will work correctly. If you specify the regular Squiggle jar file the extensions won’t be loaded and neither of their examples will work.