[rabbitmq-discuss] Fwd: Objective-C AMQP Library

Chuck Remes cremes.devlist at mac.com
Tue Jun 9 17:24:26 BST 2009


You're lucky in the sense that Obj-C gives you some of the same  
dynamism as Ruby. You should be able to give it a nice wrapper.

I'm not an Obj-C pro by any stretch but I'll take a crack at answering  
some of your questions.

1. Obj-C is a C superset, so integration is pretty simple. Just  
#include/#import the headers, make sure the correct files are on your  
path and start compiling stuff.

2. A few suggestions...
a. Keep the number of external dependencies low (see #5)

b. Use whatever the current standard is for C-based applications which  
is likely autoconf and make. This gets more complicated if you want  
your library to be usable from Windows too.

3. NSNotification is a Cocoa API so if you use it then you are tying  
the library to OSX (though NSNotification has probably been cloned by  
the GNUstep project). Use the dynamism allowed in Obj-C and use the  
Delegation pattern. If you are familiar with Cocoa at all, it uses  
delegation all over the place. Copy that idea.

4. Look at OCUnit which is an Obj-C testing framework similar to the  
old XUnit and JUnit frameworks. Ruby's Test::Unit was patterned after  
that API too so it might be familiar to you.

5. I highly recommend *against* writing common utilities like XML  
parsing. Someone else has already done the job for you so don't  
reinvent the wheel. Make it a project dependency. For an AMQP library  
I don't think you'll need to do this too often. If you really plan to  
mimic the Ruby AMQP gem, you'll want to  see out an embeddable C  
network server/library that can act as the central network reactor.

6. The largest body of Obj-C code in the world is in the Apple Cocoa  
API. Copy those patterns. You can't really make a DSL like you would  
in Ruby though.

7. Why not? You might want to write a few "spikes" (small programs  
that prove an idea out... kind of like what you do in irb).

Good luck!

cr


On Jun 9, 2009, at 12:19 AM, Matt Todd wrote:

> As a new Objective-C developer (just fiddling around with it), I've  
> been thinking of a project to get my hands dirty with. I've been  
> using RabbitMQ for some time in my Ruby projects and really enjoy  
> using it, and the AMQP protocol should be fairly simple to grok and  
> work with.
>
> Because of this, I'm currently looking to start building an  
> Objective-C based client library as a pet project to get me actually  
> working in the language.
>
> I'm thinking of using the experimental C language client code to  
> power the functionality and giving it a nice Obj-C DSL and handling  
> everything through a NSNotificationCenter to create an evented  
> interface (similar to the EventMachine Ruby AMQP library I'm used to  
> working with). This is the goal for now, anyhow.
>
> Being still very new to the language, and certainly being unfamiliar  
> with the idiosyncrasies of developing libraries for Obj-C, I'm  
> looking for input, support, and contributions for this endeavor from  
> experts and enthusiasts with strong opinions and/or time.
>
> Let me stress my lack of exposure to Obj-C (nor have I done anything  
> significant in C/C++ or any strongly typed, compiled language in  
> quite some time). This means I'm currently asking the following  
> questions (as noob as they may be):
>
> 1. How do I integrate the C library into this Obj-C library?
> 2. How do I write a distributable, clean Obj-C library?
> 3. Is an NSNotificationCenter-based implementation a good approach  
> for an evented AMQP library?
> 4. How do I mock objects in Obj-C (to not require an instance of  
> RabbitMQ to be running for tests)?
> 5. Should I just write this from scratch, including XML parsing et al?
> 6. What does a good Obj-C DSL look like?
> 7. Why would I start with a significant library to get familiar with  
> the language?
>
> Fair warning, I'm a Ruby developer, mainly building web applications  
> in Rails.
>
> Looking forward to hearing from you, and hope to get something  
> worthwhile out of this.
>
> Matt
>
>
>
> -- 
> Matt Todd
> Highgroove Studios
> www.highgroove.com
> cell: 404-314-2612
> blog: maraby.org
>
> Scout - Web Monitoring and Reporting Software
> www.scoutapp.com
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090609/47ef30a9/attachment.htm 


More information about the rabbitmq-discuss mailing list