my recent reads..

CandyMinasTirith

Behold, the White City of Minas Tirith is under siege by one of the largest, and certainly the tastiest army ever to walk Middle Earth. For two days the evil host, under the brutal licorice fist of the Witch King of Angmar has bombarded the ancient city with stone and fire...
Wow, this is some awesome holiday project. Build the Battle of Pelennor Fields out of candy? Why not! See more pics and commentary here
If they ever re-release the LOTR DVDs, they should add this as a special feature (the baking of..)!

The Riders of Rohan
read more and comment..

Nosejob

The guys from Miracle Denmark demonstrate how Oracle Database installation is so straight-forward, you can do it with your nose.

read more and comment..

Code Generation with JDeveloper

I've written about Jack Herrington's Code Generation in Action before; it is a great book for stimulating your thinking on how you go about producing code.

JDeveloper has evolved into one of the strongest IDEs when it comes to code generation. It's not explicitly mentioned in the book however. That's not a criticism of the book, but it does beg a review of how JDeveloper stacks up against the concepts covered.

Integrating code generation into your IDE


Writing a code generator can be difficult-but convincing your fellow engineers to use [it] can be even more difficult. The key .. is to make it as simple as possible to use.
IDE integration is one approach to address this problem, and the common techniques supported are external tool invocation and filtering.

JDeveloper only directly supports external tool invocation (see the Tools menu). For instance, you can call simple Ruby scripts like the following to perform file-level processing (this example simply comments each line of the file that is currently open in the editor pane).
fh = File.open( ARGV[0] )
text = fh.read()
fh.close
text.gsub!( /^/, "// " )
File.open( ARGV[0], "w" ).write( text )


NB: in the 11.1 preview, it seems the "Availability" conditions are still a little broken and it is not possible to make commands available only when a file (or certain type of file) is open.

Filters are not directly supported by JDeveloper, however implementing a filter is a fairly straight-forward project using the JDeveloper Extension API.

JDeveloper Extension API


Herrington does not directly address the topic of IDE APIs, which is understandable given the scope of his book. However if you are looking to implement complex and very specific code generation approaches you will probably want to look into this topic further.

JDeveloper comes with a comprehensive Java-based extension API which was significantly revamped in (I think) 10.1.3 to bring it into line with the standardisation efforts of JSR-198.

I must say documentation of the extension development process is a little thin. And it is only in 11.1 that JDeveloper has explicit project support for extension development (although I find it a little broken and mysterious in the preview edition). The best approach at present seems to be good ol' copy-and-modify the extensive set of samples provided by Oracle at the Extensions Exchange. There is a growing number of 3rd party open source extensions that are even available through the JDeveloper Check for updates menu.

Still, no filter add-in is available, and you are of course stuck with developing in Java. It of course puts me in mind of a little project: a simple filter add-in that then allows you to invoke a filter process developed in the language of your choice such as perl, ruby or python. Maybe I'll be able to follow-up this post with an example;-) PS: yes I did; you can read about it here.

JDeveloper's Generation Credentials


I've been hedging around the fact that JDeveloper is very significantly geared towards code generation itself. It is one of the main drawcards for why you would use it over your favourite text editor.

In the back cover of the book, Herrington includes a very illustrative Generator Tree which provides a taxonomy of generators, with of course references back to what is covered in the book. I thought I'd experiement with mapping JDeveloper into the taxonomy. I doubt if I'll manage to cover all of JDeveloper's features (or get it all right), but here goes:

ClassPlatformTechnologyHerringtonJDeveloper
Database AccessMSASPASP Generatorn/a
ASP.NETASP.NET Generatorn/a
JavaEJBEJB GeneratorEJB Entities from Tables
JDBCJDBC GeneratorADF Business Components
JDBCn/aToplink O-R Mapping
PHPPHPPHP Generatorn/a
PerlDBIPerl DBI Generatorn/a
User InterfaceJavaJSPJSP GeneratorJSP/struts/JSF wizards
SwingSwing GeneratorSwing wizards; ADF Swing wizards
MSMFCMFC Generatorn/a
DocumentationSQLSQLSQL Documentation Generatorn/a
JavaJavaJavaDocJavaDoc
Unit TestsCTestsAugmented C Unit Test Generatorn/a
Ordered TestsOrdered Test Generatorn/a
Test Datan/aTest data generatorn/a
Test Robotsn/aTest robot generatorn/a
File FormatsJavaCSVCSV file Reading Java GeneratorFile Adapter
JavaData AdapterData Adapter Generator(arguably) File Adapter; Toplink
JavaBinaryBinary File Reader Generatorn/a
Web ServicesJavaXML-RPCXML-RPC Generatorn/a?
JavaSOAPSOAP GeneratorJava Web Service from WSDL
PL/SQLn/aPL/SQL Web Service
JMSn/aJMS Web Service
Variousn/aTechnology Adapters
Business LogicJavaMathEquation Generatorn/a
JavaReportsReport Logic and Interface Generatorn/a
External Libraries*C++DLLDLL Wrapper Generatorn/a
Scripting LanguagesC++External Language Wrapper Generatorn/a
Configuration*FirewallanyFirewall Configuration Generatorn/a
Reference Data*anyLookup Function Generatorn/a
anyMacro Lookup Table Generatorn/a

*I've reclassified these items from the original table in the book.
NB: I generated the table above using an OpenOffice Calc spreadsheet [generator-taxonomy.ods]. Good example of dog-fooding perhaps;-) I've always found Excel/Calc to be really useful tools for rapidly generating scripts, SQL or HTML fragments like this.

With so much capability in JDeveloper, you might expect instant adoption. But there are of course two classic issues still to be addressed:
  1. There's quite a steep learning curve until you get comfortable with what features are available, and when they are appropriate to use. The rapid enhancement of JDeveloper and all the technology over the past few years means that your average dev shop probably doesn't have the luxury of many gurus who can coach the team either
  2. It seems to be an inherent trait of developers (arguably a good one), that generators and wizards are not fully trusted and accepted until you've had the chance to dig down under the covers. That's simply a lot of work for all of JDeveloper's features, and there isn't a great deal of information available to help your short-cut the process.
The natural conclusion is that to optimise adoption, I'd exhort the JDev team (and the community of users) to put as much effort as possible into producing resources for JDeveloper's code generation (wizards etc) and extension SDK. Importantly, to put the stress on explaining the how and why these things work (not just step-by-step tutorials).

Postscript:
read more and comment..

2007 In Review

Picking up the idea to present "my blog-year in review", by taking just the first complete sentence each month's post (remembering not to make this the first post for Jan;-)

January Apache Axis2 is the core engine for Web services.
February I've been working a bit with Oracle's OCCI (the C++ API for Oracle Database), and stateless connection pools in particular.
March Recently wanted to track down the details of the process that had a specific port open.
April "Where's the alert log?" .. usually the first thing you want to know when looking at a new database.
May Say you have a connection to a remote Oracle Database server and want to get the ORACLE_HOME setting.
June A little while ago I got to dust off my C++ skills for a project that was to use Oracle Database (via OCCI) and also Websphere MQ
July This week its my pleasure to host Log Buffer #54, the Carnival of the Vanities for DBAs.
August I've just spent the past few days at Oracle OpenWorld Asia Pacific in Shanghai.
September I've blogged previously about playing with the reCAPTCHA service in Perl.
October I had the privilege of listening to Kevin Walsh's "30/30" presentation last week.
November Well, today is my first as a member of the Oracle Alumni
December Laurent Schneider just asked what LinkedIn is good for?.

Hmm, very geek. What's not listed is the post that generated the swiftest, strongest reaction: Ballmer Peak and the Programmers' Paradox, which probably goes to show that frat humour is the surest way to internet fame;-)

During the year I also started blogging quick reviews of all the books I read over at PrataLife. So as a variation on the meme, here's my Book-Year In Review:


July
The Extraordinary Adventures of Arsène Lupin, Gentleman-Burglar (audiobook)
August The Ambler Warning
September A Different Point of View (audiobook)
October The Warden (audiobook)
November Code Generation In Action
December Quarter Share (audiobook)

The number of audiobooks is a bit misleading, as I'm sure I actually read at least as many on paper (although Neal Stephenson is slowing me down a bit at the moment!). And ye gads, only one tech book! But this is to be expected: with fiction its easy to read and do a quick blog entry, whereas technical non-fiction is generally not suited to blogging an instantaneous reaction. They'll tend to stay on my desk/shelf for a probationary period;-)
read more and comment..