Skip navigation
ANNOUNCEMENT: community.oracle.com is currently Read only due to planned upgrade until 29-Sep-2020 9:30 AM Pacific Time. Any changes made during Read only mode will be lost and will need to be re-entered when the application is back read/write.

In my software engineering class, we are designing an application that shows films and events for the Cinequest film festival on Blackberry devices. We need to get film schedules and descriptions from a server onto the mobile phones. A typical query would be: “Show all movies playing today”.

SOAP seems total overkill, and I doubt that there is a SOAP stack for the BB. (A Google search yields this page.) So, I figured it is time to embrace REST.

There are lots of tutorials on the web, such as this one and this one. To query an entity, you simply use a URL

http://someserver.com/prefix/film/112358

You can also consider sets of entities as resources, such as

http://someserver.com/prefix/films/mystery

If these entities or entity sets are immutable or change rarely, you can use the HTTP infrastructure for caching to reduce server load.

But my life isn't that simple. Moviegoers will want to see films by venue, by date, or by genre. So, what do I do? Following the examples, I would have queries

http://someserver.com/prefix/films/CAL
http://someserver.com/prefix/films/2009-02-28
http://someserver.com/prefix/films/mystery

That seems pretty hokey. I don't want the server to parse the string and divine what I was after. I considered a couple of alternatives

http://someserver.com/prefix/films/genre/mystery
http://someserver.com/prefix/filmsByGenre/mystery

That didn't seem to be much better. I ended up with

http://someserver.com/prefix/films?genre=mystery

http://yukina2x.files.wordpress.com/2007/06/the_restless.thumbnail.jpgbut it seems so RESTless. I'd love a pointer to a more in-depth tutorial or some expert opinion.

(The gratuitous image is the cover of a Korean movie "The Restless".)

http://refcardz.dzone.com/sites/all/files/refcardz/covers/5305.png My second "refcard" has been published by DZone. This time, the DZone team managed to cram an unbelievable amount of Core Java language and library facts onto a small PDF file. Check it out here.

I had a harder time with this card than with my JSF refcard. The Java library is vast, and there is no point in duplicating a tiny fraction of the API documentation.

The refcard contains the usual items--keywords, operator precedence, and so on, together with the things that I keep forgetting, such as the exact syntax of MessageFormatstrings. voodoo.jpeg(Did you know that you must use two ' for a single quote? I kept forgetting that and finally developed the memorization aid that the ' remind me of the voodoo doll pins that I'd love to use to torture whoever came up with that. Use the refcard, and you won't forget.)

The focus is on those items that every Java programmer needs, whether on the client or server side. Logging. Formatting. Internationalization. Regex. Properties.

What would you like to see on a future edition? And what would you take away to make room for it?

I am teaching an undergraduate course in programming languages. We build interpreters and compilers for toy languages, in the hope that students gain a basic understanding of syntax, semantics, and language translation.

http://weblogs.java.net/blog/cayhorstmann/archive/model-t.jpegI use Scala to implement the interpreters and compilers because of its nifty “combinator parser” library. (This and this blog have nice introductions into Scala combinator parsers.) Why not just lex and yacc, the Model T of parser generators? My colleague is doing just that, and it is a good thing because it gives students much-needed experience with C programming. But I don't have the heart to see students suffer with pointer errors. With Scala, we can implement an interpreter for a simple language that supports arithmetic, if/else, and closures, in < 150 lines of code.

I am learning Scala on the job, and I don't know all of the language features yet. In particular, surely there must be some kind of while