[MacRuby-devel] [MacRuby] #510: website: How Ruby Programmers Should Learn Cocoa

MacRuby ruby-noreply at macosforge.org
Wed Dec 16 16:22:35 PST 2009


#510: website: How Ruby Programmers Should Learn Cocoa
----------------------------------------+-----------------------------------
 Reporter:  ernest.prabhakar@…          |       Owner:  lsansonetti@…        
     Type:  task                        |      Status:  new                  
 Priority:  minor                       |   Milestone:                       
Component:  MacRuby                     |    Keywords:                       
----------------------------------------+-----------------------------------
 [From the mailing list - someone should add to the docs]
 Brian Chapados wrote:

 If MacRuby is your first exposure to mac programming and all of the
 associated tools and techniques, starting out by jumping into an
 IB-based project that uses CoreData & Bindings is going to be really
 confusing.

 I'd break up the tasks into pieces small enough that you can actually
 understand what's going on. You shouldn't feel like things are
 happening "magically". If that is the case, then try to take a step
 back and figure out how the magic trick works.

 For example, if you want to tackle CoreData first, then start with
 just CoreData.  Build a command-line program that creates a CoreData
 stack by reading in your compiled .xcdatamodel (or create the model in
 code!), add some data, and save it.  Once you've got that working,
 then make it download data from your web service and save it.

 Here is the approach I would take:

 1. If you haven't already, read through the Core Data Programming guide:
 http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html

 At the very least, browse through this to get a feel for what's going
 on.  You won't understand everything, but at least you'll have some
 sense of where to look when you get stuck.

 2. Read the Core Data Utility tutorial:
 http://developer.apple.com/mac/library/documentation/cocoa/conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html

 This gives you a basic Obj-C version of a program the uses CoreData
 entirely through the API.  Everything is done in code, even creating
 the model, so it should get you started on something basic.

 3. As it turns out, Matt Gallagher (cocoawithlove.com) recently posted
 an excellent article on parsing CSV files and importing the data into
 CoreData: http://cocoawithlove.com/2009/11/writing-parser-using-nsscanner-
 csv.html

 I highly recommend you also download and read through his code to see
 how it works.

 4. Use the code from #2 & #3 to write a minimal implementation in
 MacRuby that imports data into your model.

 5. After getting #4 to work, go back and read the section on
 efficiently importing data in the CoreData programming guide and
 refactor your import code appropriately.

 At least this way, if you get stuck on #4 & #5, you'll have a fairly
 short, self-contained example program that you can put in a gist, post
 a link, and ask for help on specific parts.
 _________________________________

 And 6. Once you believe you understand how everything works, submit a
 sample code to us! :-)

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/510>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list