Advice on OSX cocoa app with Python backend

Steve Holden steve at holdenweb.com
Tue Feb 1 08:24:32 EST 2005


Socheat Sou wrote:

> After a brief, but informative, discussion on Freenode's  #zope
> chatroom, I was advised to consult the gurus on c.l.p.
> 
> I'm working for a small company who is in desperate need to rewrite it's
> 15+ year old, flat-file, client-tracking database.  The staff uses OSX,
> while I administer the couple linux servers we have to run our website
> and some internal sites.  In our initial brainstorming session, we
> decided to go with a Python backend server, handling the database and
> business logic, and a native Cocoa application on the client side, with
> enough glue to make the two stick.
> 
Sounds like a plan, for a Mac house.

> Also, after a bit of research, I discovered Twisted and PB.  I figured
> I'd have to write a customized backend to meet our needs.  However,
> seeing as how 1) I've never written a netwo
> rk application before, let alone a multi-threaded application and 2) I'm
> the sole developer
>  on this project, I was looking for as many API's, modules, frameworks,
> and/or prebuilt solutions as possible to help me out.
> 
First of all, note that Twisted applications needn't be multi-threaded, 
as Twisted makes use of asynchronous interfaces. You *can* write 
multi-threaded code under Twisted, but you don't have to most of the time.

> I initially thought of Zope because I had often heard it referred to as
> an application serv
> er, so I thought it might be something I could use as a basis, write the
> business logic, and have the Cocoa application, with some PyObjC,
> communicate with the Zope server.  We're definately not looking for a
> web-based application, so I wasn't quite sure Zope was what I wa
> nted.
> 
It isn't. Much too heavyweight, with much too steep a learning curve for 
what appears to be essentially a simple project.

> For those that are interested, we're looking at using MySQL as the DBMS.
> From what little I know of OODBMS it doesn't seem like the right choice
> because aside from data entry and client record lookups, the biggest use
> of the database would be to generate reports and tabulated data on an
> arbitrary set of fields.  I've read that this isn't exactly the strength
> of OODBMS?
> 
Who told you that MySQL was OO? It's a bog-standard relational back-end 
with transactional capabilities.

> We are also looking at a server-client architecture, rather than
> individual clients connecting to the database over the network, because
> there are some features the staff would like (such as something similar
> to message passing between each other, and also being able to administer
> connected users).
> 
So you need a(t least one) layer between the database and the client, 
which you plan to write in Python. This makes perfect sense. Almost 
everything you find about writing servers in Python is going to work for 
you, so Google away!

> Does anyone here have any experience building an OSX application with
> Python running the show behind the scenes?  I hope I didn't come off as
> asking "tell me what to do", but rather I would appreciate any advice or
> links to resources that might be helpful in this project.
> 
Mostly, remember that OSX is effectively just another U**x environment, 
so server structures that work under BSD and Linux will tend to work 
under OSX. The unique parts of OSX appear (from the outside) to be 
Carbon/Cocoa and the funky GUI stuff. So have at it and come back for 
advice when you need it. Good luck with your project.

[OBPyCon: of course, if you come to PyCon DC 2005 you can discuss this 
stuff with experts:

   http://www.python.org/pycon/2005/register.html

The numbers tell us this could be the biggest PyCon ever!]

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list