What Do People Find Challenging About Cocoa?I sent out a general request on Twitter, asking what specifically the biggest obstacle was when you first started learning Cocoa. Out of the roughly 118 responses I got back, no one topic completely dominated.
This obviously isn't a strictly scientific study. I had to glean intent from some of the responses, and didn't include anything that came up less than twice. Also, I counted many responses for two categories. So if someone said "Objective-C was confusing at first, coming from a Java background", that would be counted as both "Objective-C" and "Used to Java and C++".
A lot of the votes here were broken down into other sections as well, so this is sort of an umbrella category. Many specifically cited how things were different from Java or C++ on Windows. The syntax itself was frequently mentioned, as was reference counting to manage memory.
Overall, this is the least surprising result since the Objective-C syntax is the single biggest difference from most other programming environments. If you asked PHP programmers what they found odd about learning Rails, Ruby would certainly be one the most common answers.
Worth noting, though, that very few said that they still hold a poor opinion of the language. It was just the initial introduction that was rough.
I Didn't Know ANSI C: 12%
Veteran programers may be surprised by this, but this is actually pretty close to what I expected. I've run into countless people in the last few years who had just started to learn Cocoa and had never even flipped the first page of K&R.
In the NextStep era, the big deal was convincing people to switch from pure C to higher-level objects, but now things have flipped. A lot of people coming to Cocoa today are used to web scripting languages, and have often never even used malloc before. Cocoa may be the sole reason they have any contact with gcc.
Cocoa is Really Big: 11%
Even just sticking to AppKit, UIKit, and Foundation, Cocoa is quite big. There are hundreds of classes in the core frameworks, and more than 80 entries in Leopard's /System/Library/Frameworks/ directory. That count doesn't even include the clusters of API buried in umbrella frameworks.
It can take quite a while to learn what's available to you, and then from there learn the pros and cons of each API so that you know when to use which one. This the is meat of what "learning Cocoa" actually is.
Memory Management: 10%
Relatively low on the list. This was mostly people who had come from Java or a scripting language and suddenly had to deal with reference counting — knowing how to use retain, release, and autorelease correctly.
Interface Builder and NIBs/XIBs: 10%
If you're used to seeing all of your program literally in code, Interface Builder and NIB/XIB files can be a bit jarring. The biggest complaint was that it feels like "magic" because you dont't know what Interface Builder is actually doing. Some said using Cocoa Bindings in Interface Builder enhanced the feeling of not being completely in control of what's going on.
Personally, I was immediately sold on the idea of using a visual layout tool to get all of the basic infrastructure up, and thrilled that I didn't have to type all of that out by hand each time. I admit I've never really understood the resistance to Interface Builder, but clearly not everyone feels that way at first. Just as with Objective-C, though, most said that now know their way around Interface Builder.
I Was Used to Java or C++: 10%
No big mystery here. Cocoa has pretty different view of life than Java and C++. You can learn the Objective-C syntax in a week, but you still might be trying to find the Cocoa equivalent of a particular class, and trying to still do things in the Java or C++ way. It takes a while to get familiar with not just the what of Cocoa but the why and how.
I was surprised how many people specifically called out delegates as a stumbling block in learning Cocoa. The overall feedback was that it wasn't always clear how delegates fit into the big picture or when you should use them.
I think this might just be learning part of of bigger Cocoa philosophy: waiting for the framework to prompt you for data rather than actively going out and setting values on things. My guess is delegate callbacks seem more natural to Rails folks, but it's apparently not as common in other frameworks.
Overall Cocoa Model: 8%
These were the cases where the individual bits and pieces made some sense, but it wasn't clear how everything fits together. I see a lot of variations on the question "how do I pass information from one class to another?"
Cocoa has a few key techniques are used over and over again throughout nearly all of the frameworks, and once you learn those, the curve flattens out. But until then, it may seem like you're just doing a series of random things that seem to have no overall meaning. If so, take heart — you're in good company. Very bright, experienced programmers feel this way at first.
I Didn't Know Object-Oriented Programming: 8%
I think this is one of the biggest shifts since NextStep. Decades ago, this would have been much higher on the list. The interpretation of object-oriented patterns varies between languages, but nearly all popular languages today feature classes and objects in some way. It's rare to see strictly procedural programming patterns for desktop or web programming.
Learning How Documentation is Structured: 5%
Some did express a learning curve in reading the official documentation, but there seemed to be a general feeling that it has improved a lot over time.
Cocoa Bindings: 5%
A few specifically called out challenges with learning how Cocoa Bindings or Key-Value Coding and Key-Value Observing work, some specifically cited the overlap in "magic" with Interface Builder.
Very few complaints about the learning curve in using Xcode to build projects. For the most part, people seem to get it.
What Do People Find Challenging About Cocoa?
Posted May 16, 2009 — 51 comments below
Posted May 16, 2009 — 51 comments below