Digital Media Mac Blogs > Mac

Cocoa Spaces


One of my favorite ideas from the world of Java that never got widespread adoption was Jini. Jini allowed devices that had unreliable network connectivity to work together in a secure and powerful way. All that Jini needed to assume was that both of the devices had Java installed and it could take advantage of this common type system to perform powerful tasks.

As a silly example suppose I want to make a video from all of the pictures I've taken on my iPhone. I want to make a simple Quicktime video with some music behind it. I have the pictures on my phone and I have the music on my phone but producing the video might be beyond the capabilities of my phone.

So my phone says "hey, does anyone here on my safe secure network of trusted devices know how to produce this video?"

And my laptop responds "sure, I know how."

And my wife's desktop responds "sure, I know how."

And my server says "sure, I know how."

And so my iPhone chooses one. Code moves from my iPhone to the device that's doing the work and soon it calls for the images and the music, produces the video, sends the video back to my iPhone and deletes the images and music from the host machine.

Just a silly example but now that we have iPhones and laptops and desktops all speaking the same language, wouldn't it be cool to have a Cocoa version of Jini? Something that even leverages Bonjour but can move code back and forth to perform tasks that we can't perform on our little handheld devices.

To be clear - I am not suggesting a Java app running on the iPhone. I'm suggesting that Apple takes a look at the River project in the incubator at Apache and takes advantage of the Apache license on the Jini technology to port it to Cocoa and Obj-C. Even more, that Apple brings the idea of Java Spaces to Cocoa so we can just submit jobs into the ether and get notified when they are complete.

Cocoa Spaces built on the ideas of Java Spaces. You can see these idea in T-spaces, tuple spaces, and the origins in the Linda project. There is even a Ruby port known as Rinda.

As we move from the desk bound world to the world where our computers come with us and move from network to network, we need to look at how our notions of computing can change.

Imagine giving your iPhone the power of a nearby eight-core Mac Pro.

Categories





AddThis Social Bookmark Button



Comments (3)
Read More Entries by Daniel H. Steinberg.

3 Comments

Probably the biggest difference, and the thing that makes Jini so unique, is the ability to send runnable objects over the wire, without requiring the other side to already have that code. For Daniel's example, the Jini philosophy would be to have some Java "interface", really just a list of method signatures, that define the ability to work with pictures. Let's say the interface includes a method "makeSlideShowMovieFromImages(...)" that returns a QuickTime movie. In Jini, your iPhone would need only that method signature. It then asks the cloud "anybody out there got an implementation of this that I can use"? The service lookup then finds appropriate services, which if chosen by the client send a skeleton class (the class that makes the remote method call) on the fly to the phone, which then executes the remote method call. I haven't worked with DO, but the programming guide at Apple suggests it's just responsible for the sharing of data objects over the wire/air (which implies to me that you'd need to already have the classes for those objects on both sides of the transport), but I'm not completely sure if that's as far as DO gets you.

haxie said:

Question:

What does Jini offer that a combination like Bonjour and Distributed Objects doesn't? I am not sure if the iPhone SDK offers DO or not, but if it does you have the power of Service Discovery in Bonjour with the ability for remote work to be done via DO. I played with Jini a long time ago and thought is was a great idea but haven't gone back since moving over to Cocoa. What are some of it's advantages over Bonjour/DO?


Oh man, I loved Jini. We did a real-world deployment of it and while it had its annoyances (particularly in terms of package hierarchy), its philosophy was beautiful. The people behind it really understood the Eight Fallacies of Distributed Computing and took to heart the inherent unreliability of making method calls across the network. Bonjour captures this to a degree (as the co-author of O'Reilly's Bonjour book would surely know), but is less ambitious, which is good and bad. It would be nice to see more Mac apps use Bonjour (I just noticed that Chicken of the VNC does now, which is great for sharing screens around the house), and for more Mac/iPhone developers to get into the mindset of Bonjour and Jini. These people who insist that the iPhone SDK has to allow background processes so that they can keep an always-on connection to some service must be living in a world where mobile network connections are a lot more reliable than they are in the world I live in.

Leave a comment


Type the characters you see in the picture above.

Topics of Interest

Related Books

Archives


 
 


Or, visit our complete archive.  

Stay Connected