REST, APEX, PL/SQL and Me

This past Sunday I gave a talk at the ODTUG Kscope conference in New Orleans titled Implementing RESTful Web Services with Oracle Application Express. The presentation along with sample code and test tool can be downloaded from the APEX collateral page on OTN.

I’ll describe the talk a little more at the end but first I want to tell how I got here. I’m not talking about my flight but rather what’s a Java web developer doing talking about APEX.

I was on the WebLogic Console team, then I moved around a little bit and now I work on the APEX team.

Long ago when I created my first web app with Java I was a Java Developer using Java to make a web app. But as time went on — and along with an industry wide shift in focus from the server to the client — I became a web developer implementing the back-end in Java. I now prefer JavaScript over Java. I also prefer working on the infrastructure for web apps (including making rich UI widgets) compared with just the apps themselves.

For a long time now I have believed that there is an easier way to make web apps and the key is in declarative specification. My ideas for a declarative framework had support within the Console team but projects, priorities, and people tend to shift around. First I was moved to the Fusion Middleware Control team, which has a very good manager and team but ADF was never a good fit for me. Then I got an opportunity to work on an HTML 5 related project that had the potential to realize my declarative framework ideas but that turned out not to be a good fit either. Meanwhile I started to notice that although Oracle advertises ADF as the way to build web apps that there were some internal web apps that were clearly not built with ADF. I looked a little closer at these apps and found this thing called APEX.

I could tell just by looking at the UI design and the HTML, CSS, and JavaScript behind these APEX apps that there was a framework there that knows what html 5 and modern web apps are about and is actively working to get there. I read a little more about APEX and came to understand that APEX really gets declarative rapid app development. I contacted Joel Kallman and let him know what I do, what I understood about APEX, and asked if they wanted my help. Then, bam, just like that I was on the APEX team. (at Oracle bam means 3 months later.)

For the most part I work on JavaScript code in APEX. One thing Joel said to me in our first conversation is: You know APEX is written in PL/SQL right? Sure, I said, but it took a while for this to fully sink in. I figured I would probably need to read PL/SQL but would mostly write JavaScript. I have ended up learning PL/SQL and writing a fair amount of code. I enjoy learning new languages but PL/SQL was never on my list of languages to learn. It may be unusual for a Java developer to switch to PL/SQL — you more often hear of them moving to Ruby or Scala — but I don’t hate it. It does feel like an old fashioned language to me but when it comes to programming the Oracle database there is no better choice. I think it does a great job of fitting in with the SQL style. I like using the right tool for the job. Putting the business logic close to the data makes a lot of sense to me especially compared to the complexity and overhead of object-relational mapping.

I’ve been on the APEX team for just over a year now and I’m very happy. The APEX team is a great bunch of people to work with. Also the APEX community is very active and I’m getting to meet some of them here at Kscope.

So back to the talk I gave. The ability to define RESTful Services in APEX is new in version 4.2. I didn’t work on any of the implementation of it but I have a general interest in REST and experience from creating the REST infrastructure for WebLogic Console so I wanted to try it out. Because APEX RESTful Services is so new it was lacking in examples and documentation but that is starting to change. The latest APEX Listener download includes a doc folder with very helpful information. In my talk I walked through a (mostly) complete example of a REST API for the sample database application, which I believe demonstrates many best practices of REST. I also created a tool for testing RESTful services that has a few features that make it ideal for APEX RESTful Services. Both the example and APEX RESTful Services Test Client are available for download. If you have any comments, questions, or feedback on the test tool or example please let me know.