Category Archives: Programming Languages


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.

JavaFX’s FXML a big step backwards

I shouldn’t care about this because I don’t use JavaFX. But it bugs me so I’ll rant a bit.

A while ago (probably around version 1.2) the language caught my eye. I especially liked its literal declarative syntax for creating tree structures and data binding. I thought I heard that Oracle was discontinuing JavaFX but version 2.0 is in beta. I now realize that it is only JavaFX Script that is canned — JavaFX is alive and well. (JavaFX Script lives on in visage.) The features of JavaFX are available as APIs that can be used from Java or other languages on the JVM. This is a good architecture.

Writing procedural code to construct a scene graph looks as ugly and cumbersome as JavaFX Script was elegant. To “fix” this problem FXML was invented. FXML is a XML dialect for declaring a scene graph.

From what I have read there are two main motivations for using XML:

  • Familiarity — from the getting started with FXML page: “One of the advantages of FXML is that it is based on XML and is therefore familiar to most developers”
  • No need to compile (presumably changes to FXML are made on the fly without having to restart the app). This is fair but doesn’t imply that XML is a good answer.

The familiarity argument is false. It confuses syntax with semantics. Yes many developers are familiar with the syntax of XML but just because someone knows XML Schema doesn’t mean they will have any understanding of XSLT. One must still learn the semantics of FXML and that’s the hard part.

Here is what I think is bad about FXML:

  • XML is just not a convenient language for source code. It is verbose and cumbersome. It has lots of little things that get in the way such as entity references. New programming languages including declarative ones should not be XML.
  • Use of character case in element names to distinguish between instances and properties is ugly.
  • Properties can be represented by either XML attributes or XML elements. This is practical but confusing and stems from using the wrong tool for the job (XML).
  • Type coercion.

And a few things I liked:

  • Use of XML processing instructions.
  • Built-in support for string translation. But it doesn’t go far enough. It should eliminate the need for maintaining resource property files and support format substitutions.
  • Concept of static properties.

What FXML shows is the importance of having a literal representation for data. It looks like FXML could be used to build arbitrary heterogeneous object trees which is generally useful. What I think is really needed is an object literal syntax for Java similar in concept to what JavaScript has. The syntax used by JavaFX Script would make a great starting point.

Angular, Bindings and Templates

I recently watched a video about a cool new technology called <angular/>. It looks like a great way to create web applications. It caught my attention because I saw in it some parallels with some of my recent writings and what I am currently working on.

The video was very good but in the beginning Misko Hevery struggled a bit to describe it and at the end admitted the biggest problem was explaining to people what <angular/> is. To me it is clearly a language, and an extensible one at that. It is (or at least contains) as he describes an HTML compiler. Doesn’t a compiler imply some language to compile. The source is clearly more than just HTML so it must be more than just an HTML compiler. I wonder if there is some reason he avoids calling it a language. The fact that it can be extended to handle new behaviors, widgets, etc. just makes it a better language. Is there some fear that calling it a language would put people off? It doesn’t bother me since I previously said that higher level languages will provide the biggest productivity gains.

The parallels I was talking about are:

  • Its a declarative language
  • The language is designed to be extended
  • It has two way data binding

Two way data binding is a very important aspect in simplifying the creation of web apps. The first time I ever saw data binding was back in the the late ’80s. I was visiting a friend that was working on a maser, which is cool (literally) in its own right, but what caught my eye, as he showed me around his lab, was some software running on an old Mac. That software was LabView. The fact that a line drawn between a sensor and a gauge meant that any time the senor value changed the gauge was updated really impressed me. More recently I noticed that data binding is built in to the JavaFX language. I haven’t written any programs in LabView or JavaFX so I’m not sure if the bindings can be bidirectional but I’m pretty sure at least in JavaFX that bidirectional changes can be accomplished.

It is the two way data bindings that most notably distinguish <angular/> from template languages. I used to be a big fan of template languages, and StringTemplate was my favorite. Lately I have found them to be less useful. One reason is that in my recent work I have found that procedural logic far outweighs the amount of template text. The bigger reason is that most template languages don’t automatically protect you from script injection (XSS). There are many JavaScript template languages available now and I don’t have a need for any of them. But <angular/> is different — it is not a template language and it looks like it protects against script injection by default.

<angular/> is new but it looks very promising.

Implementing a domain specific language

I have been so busy at work lately that since wrapping up the climbing robot I haven’t had time for any substantial personal projects. What I’ve been working on is a declarative DSL for implementing a web application based on ideas I previously wrote about. Like I said its a work project so I can’t go into any details. I will say that I’m working with ANTLR v3 and jQuery, which are technologies I really like. My point in mentioning it is that if you read that post and wondered, like I did, if those ideas would work I believe the project is far enough along that I can say that they do.

A declaritive language for web applications

In a couple of recent posts I have argued that a higher level language is needed to
provide a significant boost to programmer productivity in the area of web applications. This is a topic I have been thinking about for many years. I’ve worked out some aspects of what I think the language should be. A little over a year ago I even started implementing a parser for the language in ANTLR. I worked on it for a few weeks before moving on to other higher priority projects. Higher priority simply means something more interesting caught my eye. It’s finally dawning on me that I’m not going to get a big enough block of free time to work on this any time soon. I guess I prioritize the smaller projects that have a better chance of getting finished.

Instead of mothballing the project completely I’m going to share some ideas from it. This his may be of interest to others and who knows, I may get back to it from time to time.
Continue reading A declaritive language for web applications