The
Ultimate
Business Machine

Technology, business
and innovation.

And, not least, about
the Mac.

Weblog Archive Cutedge

by: Bernard Teo






Latest Joy of Tech!

Joy of Tech ... from Geek Culture



Creative Commons License

Copyright © 2003-2012
Bernard Teo
Some Rights Reserved.

The Ultimate Business Machine - Archives

List of Categories : Commentary * Database * Singapore * Technology * Travel *

Wed 01 Dec 2004

Java and Objective-C Development on Mac OS X

Category : Technology

Objective-C code may look daunting at first, but it's really mainly C code with extensions to the language to deal with objects and message passing.

Both Java and C are small, compact languages that can (each) be learnt in one weekend - that is, if you're determined and start on a Friday night. Good books to use include the "Java in a Nutshell" book from O'Reilly and the Kernighan and Ritchie book for C.

The "Java in a Nutshell" book contains a good introduction to object-oriented programming and the advantages of using this approach to control code complexity.

I've got a few books on Cocoa programming but I think the "Learning Cocoa" book from O'Reilly is actually good enough to get started (I have the original version that was much maligned but the second edition by James Duncan Davidson should probably be better). I found some of the explanations mystifying (in my original version of the book), at least initially, but it contained very good, useful, sample code that you can adapt quite easily to do your own stuff. And, after a few rounds, things do become clear.

The important thing is to learn by doing - to plunge in and set yourself something useful to do by modifying from the given examples. Then it rapidly becomes clear what it is that you don't yet know, and from filling in the pieces, you start to create a mental model of how Cocoa works. I think there's a certain point where everthing clicks and you start to see the patterns in the way Cocoa works and learn to flow with it. (That's why there is a book called "Design Patterns".)

Now, I think we (Hai Hwee - who wrote Luca - and me) took a longer (and much harder) route into Cocoa by starting with Java. Cocoa's native language is Objective-C, and, though it is possible to write Cocoa apps using Java, you always have to translate the Objective-C calls into their equivalent idiom in Java, and there are far fewer sources of information about writing Cocoa code using Java. (As Aaron Hillegass says, in his book "Cocoa Programming for Mac OS X" 2002 edition - "Using Java with Cocoa"? "Don't ...").

But we have a lot of stuff we've invested time in building (database and web server stuff that call Oracle and MySQL) and it was easier to extend the Java code to work with a Cocoa front-end than it was to rewrite all that stuff in Objective-C. And where was the database solution on Cocoa in Objective-C, then? Nothing, not a single thing at all. No wonder there was not much going on for business applications on Mac OS X.

But, now, there's the possibility of taking advantage of CoreData in Tiger. One of the problems we have with Luca (besides the fact, I think, that it requires a good inventory module to make the system really gell for an end-user), is that it's too big a download. We can't assume that a user has MySQL loaded on his Mac. That is the target database that Luca uses. So we include a MySQL download. Even if a user has MySQL, we often have problems making Luca work with that existing installation. So it'll be great if we can assume that there is a database that comes with every Mac. And target Luca (and any other business application that we hope to build) to work with that common platform. And our applications could then become smaller and be easier to download.

So that's why I think we could expect to see an explosion of business applications on the Mac. But it all depends on how good CoreData is.

I do wish Apple could stop re-inventing the wheel and re-use stuff that are already out there - like all that JDBC stuff that work with almost every relational database solution on earth. Or, choose MySQL to bundle in rather than SQLite. Or make Objective-C work a bit more like Java in terms of memory management (all that "release" and "retain" code give me a headache).

We've now got two great platforms to create applications with on Mac OS X - Java and Objective-C, and Cocoa. It'll be great to get the best of both worlds. But part of growing up is to accept life for what it is and just move along. So on we go.

Posted at 2:08PM SGT | permalink


Mac@Work
Put your Mac to Work

Sivasothi.com? Now how would you do something like that?

Weblogs. Download and start a weblog of your own.

A Mac Business Toolbox
A survey of the possibilities

A Business Scenario
How we could use Macs in businesses

VPN Enabler for Mavericks

MailServe for Mavericks

DNS Enabler for Mavericks

DNS Agent for Mavericks

WebMon for Mavericks

Luca for Mavericks

Liya for Mountain Lion & Mavericks

Postfix Enabler for Tiger and Panther

Sendmail Enabler for Jaguar

Services running on this server, a Mac Mini running Mac OS X 10.9.2 Mavericks:

  • Apache 2 Web Server
  • Postfix Mail Server
  • Dovecot IMAP Server
  • Fetchmail
  • SpamBayes Spam Filter
  • Procmail
  • BIND DNS Server
  • DNS Agent
  • WebDAV Server
  • VPN Server
  • PHP-based weblog
  • MySQL database
  • PostgreSQL database

all set up using MailServe, WebMon, DNS Enabler, DNS Agent, VPN Enabler, Liya and our SQL installers, all on Mavericks.