Re: COM on mac
Re: COM on mac
- Subject: Re: COM on mac
- From: Andy Satori <email@hidden>
- Date: Tue, 14 Jan 2003 14:31:42 -0500
Let's say for example, I have a server business object, or application,
called, 'CAB'. It's running over there on the machine called 'AppServ'.
Let's say that Hypothetical application exposes a method called
'GetVendorList' that takes the parameters 'ProductType' and returns a
recordset of Vendors that offer the products meeting the producttype
criteria. Now, just for the sake of compatability, we'll just say that both
machines are Mac machines, let's not introduce the Windows <-> Mac COM mess
into this.
In the Windows world, you would use that remote object via COM/DCOM with the
following code: (I'm using VB for simplicity of the example, it's true in
any language, the syntax and complexity varies greatly)
Dim obj as CAB
Dim RS as ADODB.RecordSet
Set CAB = CreateObject("CAB", "AppServer")
Set RS = CAB.GetVendorList("books")
Now, the same methodology applies locally for objects and applications as
well, but let's just use the remote methodology for giggles.
From what I can tell, using Cocoa, and Objective C, the NSMutableArray of
NSDictionary elements is as close to the recordset as you'll get. No
biggie, I get that. What I don't get is a real world example of the 'I want
to create an instance of an application or framework for use in my
application on a remote machine and call it's methods'.
Now, I've used AppleScript to do a limited amount of this on the local
machine, using Mail, iCal, AddressBook, and Entourage to accomplish some of
these tasks via AppleScript isn't very difficult (if some of the syntax
isn't a little confusing, I still can't figure out how to determine if a
Todo item from iCal is 'completed' since "if completion date of aTodo is not
null then" doesn't work). That's dandy, but how do I know take that concept
and apply it to the Objective C environment and distribute it across a pair
of machines?
I might add that Apple Events probably come second nature to an old Mac
programmer that came from the Toolbox, through Carbon to Cocoa, but coming
to Cocoa, from Win32 introduces wrinkles that you probably are overlooking.
One of those is that we are apparently spoiled to having a lot of the
boilerplate code of remoting objects and applications hidden for us by some
smart if inelegant tools. Please don't get me wrong, I love my Mac, but
there are paradigm shifts in the development methodology that are painful,
and that's coming from someone who is comfortable with both Unix and IPC, as
well as doing low level Win32 stuff. I can do all of the remoting in C++
too, but I don't see any clear documentation of how to take the COM concepts
and apply them here. The closest I've found is to forego a native method
and use CORBA with all of it's overhead, or build a Cocoa Java layer and use
the Java remoting tools.
Perhaps I'm barking up the wrong tree. Ultimately I suspect the Rendezvous
is going to help this situation, but as far as I can tell, it helps with the
discovery process, but doesn't provide any tools for abstracting away from
having to write a full client and server TCP implementation using BSD
sockets, and making the decisions that that kind of design entails.
Here's to hoping that I'm wrong.
Andy
On 1/14/03 2:04 PM, "matt neuburg" <email@hidden> pounded the keyboard
to produce:
>
On Mon, 13 Jan 2003 13:20:34 -0500, Andy Satori <email@hidden> said:
>
>
> That said, if someone else can provide a pointer to a real
>
> world example of automating an external application from
>
> Cocoa, I'd like to see it as well
>
>
I'm having some trouble grasping what it is that you don't understand, perhaps
>
because I've been using a Mac for so long that for someone to come along and
>
claim not to understand Apple events is like seeing someone try to talk into
>
the mouse. If you don't know about Apple events then what's a Mac for? :) The
>
best introduction to Apple events is (in my not particularly humble opinion)
>
the first few pages of the chapter on driving external applications in my
>
Frontier book, which you can read online. I have posted code here before
>
showing how to send Apple events from a Cocoa application easily, so check the
>
archives. And of course this is what AppleScript Studio is *all* about so one
>
thing you could do is just read the tutorial for that. There are lots of books
>
and web sites about AppleScript too. m.
>
>
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
>
pantes anthropoi tou eidenai oregontai phusei
>
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.