This post started with a point. It didn’t end with one. So, I’m going to start it again and just get to the point. What makes a good Ruby Cocoa development environment. I’ll get into my rambling thoughts below, but quickly; straight up XCode/Interface Builder, HotCocoa, Interface Builder and command line building, some combination of all three or something else.
If you were going to do it, how, or what would you do?
I’ve been playing with the above three options as I’ve trying to figure this out myself. I’ve done a few straight HotCocoa applications (SilverLining, Rife and Postie) and, while they worked out well, I found the need to do all the layout by hand tedious and boring. I really like Interface Builder for ease of UI creation.
Taking that, I tried the XCode/Interface Builder solution and went to the bundled MacRuby XCode templates. When programming Objective-C I really enjoy XCode, it makes things easy when doing purely native Mac applications. That said, XCode irks me when doing Ruby development. Maybe it’s muscle memory, not sure, but I like using TextMate to do my Ruby work.
The approach I’ve been using in my latest fiddlings (Touchstone) started with the XCode templates but I broke out, stole some of the rake tasks from HotCocoa, and switched to TextMate and the command line.
The biggest issue I’ve run into is the Interface Builder integration kinda sucks. It does work, but you have to reload the class files manually all the time. A bit frustrating.
On the flip side, I can organize my code however I want. The tendency for Objective-C programs to have all their code in the root directory drives me up the wall. Sure, XCode hides this, you can change it, but, by default, everything ends up in the root folder. Maddening.
With Touchstone, I’ve put all the application code, similar to Rails, under App/Controllers, App/Models, App/Helpers and App/Views. The same structure is copied into the .app file when it’s generated. Everything feels much cleaning. The .xib and .xcdatamodel files get compiled and moved as needed.
I know I could have used the XCode build stuff but having to launch XCode and getting the debugging output in an XCode window didn’t feel right for me. I wanted something a bit more contained.
Coming back to the original question, I think what I want to see, is something similar to Touchstone but with the convenience of HotCocoa. The HotCocoa mappings make a lot of things feel more Rubyish, feel more natural. Those bindings, combined with Interface Builder, I think, would make a kick-ass Cocoa programming environment.
Again, how would you do it?
Hello
As I just started learning MacRuby and Cocoa I was wondering how to keep the project folder clean. Your post is the first I see that mentions how to structure applications and even provides a working code example.
Unfortunately I don’t really get how to tell Interface Builder that a new (e.g. controller) class has been created. It would be of great help to me if you could elaborate on your workflow when creating new classes or changing old ones. Maybe this should even be extended to a full-blown tutorial like the HotCocoa Getting Started guide.
So to answer your question how I would do it… I think it’s plain to see that I like the ‘Touchstone approach’ best ;)
Thanks for your Post
Under the File menu in Interface Builder there is a Read Class Files… and Reload All Class Files. The first lets me add a new class to IB and the second lets me reload all the known controllers when I add outlets or actions.
Hi there,
First of all – thanks for pointing us to your MacRuby app… very inspiring to see how you constructed it. I am myself just diving into Mac/iOS development and learned a lot.
Interesting for me is also the subject matter – I was trying to make an app to read the DDI Compendium myself. Problem is, no matter what I do my calls to the ../login.aspx?page=monster&… webservice keeps returning http 500 errors, or redirecting to the sign in page itself.
Can you give any more tips? Have there been any recent changes to the API that were never documented anywhere? FYI here is my Python code that I am using to do quick testing…
import urllib2
import urllib
VIEW_STATE = ‘/wEPDwUKLTMxMzExNzE1NGRkUIiT/XZKTGHIa09Q/IB82muzfOhRNx7NZZuJ7IRulEc=’
EVENT_VALID = ‘/wEWBAKzudSfBQKyzcaDDQLyveCRDwK4+vrXBT0fwJj9Pej9k0DrbshzCIJ38MlAa1d8EB0Bp5w5sHHt’
insider=’InsiderSignin=Sign+In’
email=’mymail@gmail.com’
password = ‘mypassword’
URL=’http://www.wizards.com/dndinsider/compendium/login.aspx’
if __name__ == ‘__main__’:
login=urllib.urlencode({‘page’:'deity’,'id’:’2′,’__VIEWSTATE’:VIEW_STATE,’__EVENTVALIDATION’:EVENT_VALID,’email’:email,’password’:password,’InsiderSignin’:'Sign+In’})
headers={‘Content-Type’:'application/x-www-form-urlencoded’,'Content-Length’:len(login)}
req=urllib2.Request(URL,login,headers)
print login
response = urllib2.urlopen(req)
data = response.read()
print data