The Ultimate Business Machine - Archives
List of Categories : Database * Technology * Commentary * Singapore * Travel *
Fri 14 May 2004
About Cocoa and Java, and Luca
Category : Technology/JavaCocoaSummary.txt
About six to eight months ago, when we thought of putting a Cocoa interface on top of our accounting system, there wasn't much information we can find about doing Cocoa development using Java. Even now. So this is what we've found.
First thing, we wanted to be able to do most of the common things we would expect to see on an Aqua interface, using Java instead of Objective-C, e.g., drawers, sheets, dialog boxes, the search mechanism, radio buttons, check boxes, pop-up menus, the notification mechanism, tables with hierarchical data views, page setup, print previews, etc.
It's very difficult to find material on this but this page at Whiningdog.net helped. Not nearly enough, but it kept us going. Even things like printing and exporting - they're no cakewalk. I believe Hai Hwee had to be pretty tenacious to find the answers to doing all these things.
But we now know that it can be done. And that the Model-View-Controller paradigm works very well. We've retained the ability to use 60-70 % of the code as a webserver-based application, and we've abstracted out the database access, so we can plug in a wide range of databases. These were the two main reasons why we had to stick with Java. But we've got almost all the interface elements pinned down now, so we can concentrate on building the application.
The accounting application was written originally using 4th Dimension. Comparing the two, I'm impressed with the amount of code we didn't have to write using Cocoa.
For example, when you open up a lot of windows, you may be providing different views of the same piece of information from different angles. So when you change the data in one view, you want all the views to be updated quickly. I've written the code to do that myself in 4D, but it's always been pretty messy. Think about all the things you have to coordinate. But Cocoa's notification manager is really neat. You can set up the updating mechanism with just a few lines of code.
Another example is ability to show a hierarchical view of tabular information. Again, I wrote all the code to do that when I was using 4D. With Cocoa, it's a breeze. So I can immediately appreciate the benefits that Cocoa brings from the productivity angle. The best code is the code you don't have to write.
It's a wonderful development environment. I would like to show this to more Java programmers but I think, as usual, the thing that will come up again and again is the Mac's limited market share.
Anyway, if you're looking at Luca, look at the navigational aspects, the ability to relate one piece of information to another, and the thought that went into the data structures (I think MYOB can only do Chart of Accounts maybe four levels deep and we've asked ourselves why not any number of levels deep - the answer lies in the design of the data structures).
Luca may be no great shakes to look at now (from the romantic point of view), but the beauty that we're talking about is from the classical viewpoint (in Robert Pirsig's terms, as I've written about in "Awk", the classically-minded person is pre-disposed towards looking at things below skin deep).
The problem we wanted to solve was how to make the relationships between all these accounting figures clear, and how to prove the accuracy of the data through the ability to audit the information from many different angles. And then to take this ability and make it available through the web, through a client-server application, or through web-service calls, using largely the same body of code. We're not through with this yet, not by a long way. If you're interested to build on top of it, e..g, through embedding the system as a Jar library within a larger project, through the API's we're going to make available, just let me know.