iPhone Journal Day 4 - MVC and turtles all the way down

February 14th, 2009

Today, I started digging into documentation on Cocoa’s interpretation of MVC patterns in the Cocoa Fundamentals Guide. The design patterns chapter focused too much on jargon to be useful for me, but the MVC chapter cleared up a lot of things. I like how Cocoa’s use of MVC terminology tries to be useful rather than falling into the recursive trap of obsessing about logical  consistency, as I’ve seen happen elsewhere.

I used to buy into jargon like “View Models”, “Control Models”, “View Control Models”, etc., but you’re modeling whenever you abstract. We perceive the world through many layers of abstractions, and three layers aren’t enough to model reality, or even just the slice of reality you’re working with. I used to get confused trying to model human-machine interactions into a three-layer ontology because that’s I thought we were supposed to do. Then, a wise man helped me see the limitations of MVC by shattering it against our concurrent, physical (metaphysical?) reality. It’s really just turtles all the way down, man, so, like, stick to the problem at hand. :-)

iPhone Journal Day 3 - making more sense

February 13th, 2009

The iPhone SDK has started to make more sense. You just have to flow with how Apple wants you to code. The Cocoa Fundamentals Guide offers this pithy advice: “Instead of incorporating library code into your program, you incorporate your program code into the framework.”

So far, I get along ok with Objective-C thanks to a previous interest in Smalltalk (not that I’m fluent). Years ago, I stumbled onto the Smalltalk definitions for “Object” and “Class” while exploring in Squeak’s class hierarchy browser. I was struck by how the dynamic language defined Classes as class descriptions, classes as Class objects, Object for creating/counting all instances, and everything else as instantiable classes. Wow. I barely understood these old-school gems, but they hinted at a much simpler and more powerful way to add object orientation to a language. Anyways, I’m still no rocket scientist about this stuff, but NSObject hints at the same mechanisms from Smalltalk layered on top of C, which makes Objective-C easier to appreciate.

Many thanks to fellow Flashers for more tips and resources too!

iPhone journal day 2 - skim the big picture

February 12th, 2009

After you register for an iPhone developer account, Apple presents you with lots of beautiful documentation. In fact, it’s almost TOO much documentation for someone who doesn’t know where to start. After much wandering around, I pieced together a better roadmap for building up my iPhone knowledge. This might not be the best approach, so let me know if you have any feedback or suggestions.

1) If you’re a visual thinker like me, you might want to spend a few seconds looking at the Application Life Cycle and Event-Handling diagrams in the iPhone Application Programming Guide. These diagrams illustrate the sequence of events as an application starts, responds to user input, and then shuts down. Seeing this diagram was a relief to me after trying to piece together concepts from other sources. This took around 15 minutes.

2) Read the Cocoa Fundamentals Guide first, especially “The Cocoa Environment“,  “The Cocoa Frameworks“, and “The Model-View-Controller Design Pattern” chapters, to prepare some mental categories of code you’re going to see later. It’ll give you a frame of reference when you see classes with different prefixes like “NS”, “CG”, and “UI”. Skip any Mac-specific parts unsupported by the iPhone, such as Core Data. This guide took me around 2 days to study carefully, but you might skim it quickly in an afternoon.

3) By the way, I made the mistake of reading the entire “Objective-C 2.0 Programming Language” reference manual from beginning to end, which is why this blog post is titled “day 2″. The summary in the Cocoa Fundamentals Guide is much shorter and more relevant to getting started.

4) Skim the iPhone Development Guide to get some hands-on familiarity building basic apps in XCode, even if you’re not sure how everything works yet. Explore sample source code with tips in Step 3.

5) Learn how to turn XCode into a learning environment with code sense, Research Assistant, and instant shortcuts to documentation. I’ll blog more about this approach later.

My strategy is to build a mental model of the language and frameworks as a whole first. It gives me a way to piece things together in my head so that I know where to look for information later, but this does require more patience in the beginning.

Finished reading Objective C Language Reference

February 11th, 2009

I finished reading the Objective C 2.0 Language Reference from beginning to end. Great documentation, but reading this probably wasn’t the best way to actually start building an app.

A Harbinger

February 10th, 2009

The iPhone itself isn’t as interesting as the coming change it represents . It’s a harbinger of a new lifestyle (well, more new to Americans), regardless of which carrier or manufacturer “wins” the market. I look forward to spending less time tethered to the PC and spending more time interacting in the real world.

You can always come back, but…

February 10th, 2009

In the three years since my last blog post, I have shipped some Microsoft products, co-founded a newspaper web startup, co-founded a Flex consulting company, did some traveling, and lots of other stuff. I want to start blogging again, so it’s time to archive the old blog permanently and create a new one. As Picasso said, “Every act of creation is first of all an act of destruction.”

Why did I stop blogging? Participating in the Flash community has been a big part of my life since 1999, so going offline in 2005 was a hard choice. Earlier in 2003, I had joined a Microsoft team in incubation to create UI design tools for a hot new Windows framework. The work focused exclusively on desktops, so permission came easily to continue blogging and speaking at Flash conferences on my own time outside of work. I naively saw a clean separation between day job and hobby, but a couple years later, Microsoft modified its desktop technology to compete directly for Adobe’s browser plugin market, while Adobe adapted its browser plugin to compete in the desktop and enterprise markets. Perceptions about this new competition really affected the tone of my community interactions, so I decided to stay out of the growing rhetoric, and focus on helping my teammates finish what we started. The v1.0/1.5 product cycle ended up taking over four years…  I was the only original program manager who stayed for the entire march. After leaving Microsoft, I had a lot of fun and success doing Flex and Flash consulting again with some talented people, but I never managed to resume blogging or to participate in the same way again. This will be a different blog for a different time. Bye old blog.

“You can always come back, but you can’t come back all the way
Only one thing I did wrong
Stayed in Mississippi a day too long” — Bob Dylan


P.S. Many thanks to Sarah for continued encouragement to get back into the blog conversation again!