PDA

View Full Version : How to deal with (and fix) fragmented Obj-C knowledge?




iindigo
Aug 29, 2010, 08:45 AM
Hey guys,


For those of you who haven't seen me around before, allow me to introduce myself.

I am a 21-year old college student (art major) who has been using Macs ever since my mother bought our first computer back in 1996 (Performa 6400/200, if you remember those!). Since then, I have become something of a computer enthusiast, dabbling in just about anything and everything digital, ranging from modding classic Mac OS/apps/games with ResEdit to web/graphics design to film editing to programming. I've used all versions of Windows and Mac OS from 1996 onward (even the OS X public beta), BeOS PE 5, and several flavors of Linux.

My first foray into programming was back when I was around 11 or 12 years old. At that point, the ability to create one's own software was an amazing ability to me, and something I wanted to try. I had read about the various Mac programming tools at the time (Mac Programmer's Workshop and CodeWarrior come to mind), and I even downloaded MPW to toy with it, only to be disappointed that it appeared to be little more than a glorified text editor - keep in mind, though, that tutorials and introductions to C/C++ programming on the Mac were very sparse on the internet back in 2000, so I really had no idea of knowing what the tools were for.

Then, one day in 2000 or 2001, I ran across REALBasic... I think it was on a MacAddict software disc. Installed it, fired it up, and was dazzled. It allowed me to build a nice UI as easily as I had created my numerous doodles in ClarisWorks. After a while, I really started catching on to the whole BASIC part of RB and actually created some half-functional programs. RB seemed like magic. However, it wouldn't tide me over forever.

Fast forward a year or two. I'm now using OS X 10.0/10.1 and have gotten far enough with REALBasic to really start getting frustrated with its limitations and inability to do seemingly basic things without unnecessarily expensive plugins to make up for the IDE's weaknesses. One morning, out of curiosity I pop in the Developer Tools CD and install them. I fire up Interface Builder and once again am enchanted - "it's like REALBasic, except better!" I thought to myself. Of course, I was gravely mistaken, but that is of no consequence - it marked the beginning of my accumulation of Obj-C/Cocoa experience.

Over the past decade, I've dabbled here and there with the language, slowly making progress (though certain individuals have boosted my level a few times). Eventually, I once again got to the point of creating somewhat-functional applications. When working on a project, though, I usually end up hitting something that I can't figure out at that particular moment, stalling its progress. This has resulted in a folder chock full of projects at various states of completion.

Now finally, after that lengthy stretch of text, I will mention what I think is my problem. When it comes to Objective-C and Cocoa, most of what I learned, I learned the same way as I had learned HTML: by example. I google "how do I do this", find the solution, put it to use (not just copied and pasted, mind you), and archive it in my head for future times when I need to do that task.

Because of this, my mechanical knowledge of the language is weak. While there are exceptions, I don't know why things work the way they do, why one method might be a smarter choice than another, and how the pieces all work with each other. As you might guess, this is a huge problem and often stands in the way of my ability to do basic things in Obj-C.

So finally, I ask: How do you guys recommend dealing with this problem? I'm really not sure what to do, so any help would be appreciated.


Also, sorry for the huge post. I just felt that it might be necessary to fully understand my current position.



ranguvar
Aug 29, 2010, 09:01 AM
If you don't understand the syntax, buy a book (for example "Programming in Objective-C 2.0" by S. Kochan).

Once you understand the syntax and the basics of Cocoa, I guess learning by doing (learning by doing mistakes, that is) is the way to go. Your post sounds a bit like you just lack some experience, not fundamental understanding.

HiRez
Aug 29, 2010, 08:34 PM
I think just getting in there and doing it is the most important thing, the more you code the more comfortable you will be. I don't think there's anything wrong with that approach. I read a lot of stuff about programming (books and blogs), but there's no substitute for just hacking away at a problem. Usually someone (like on Macrumors) can help you find a solution to a problem when you do get stuck, or at least point you in the right direction.

1. Choose projects that interest you (assuming you're just working on them for your own education, for now). For me, something that animates a shape is more interesting than something that manages banking transactions, for example, making me more likely to finish the project and see it through the hurdles when it becomes hard work. You may need more broad knowledge in the future, but in the beginning I think maintaining your interest is more important.

2. Don't get too aggressive with your projects at first. It's very tempting to get a mindset to create the coolest [whatever] app that has every feature you ever dreamed about. Keep projects small and simple and set just one or two achievable goals for each one. As you start completing projects you can begin to expand the scope slowly. Always ask yourself whether you really REALLY need a feature before you add it.

3. I would recommend not diving outside of Cocoa + Objective-C until you are comfortable with it. APIs based on older, lower-level languages (C, C++) can get confusing and bog you down. Believe me, you don't want to get involved in how to translate Pascal strings and FSSpecs until you have to (which is hopefully never). This means I would mostly stay away from things involving low level QuickTime (C-based, there are some Cocoa-based QT APIs also), Core Audio, OpenGL, maybe Quartz and Core Graphics, etc.

4. Try to go the whole way with even simple projects. That means writing a short design document outlining the goal and scope of the project, designing icons, writing and maintaining code comments and user-presentable descriptions, help files, versioning, history, etc. This will get you in the mindset of making these things an integral part of any project.

Not that I'm an expert; I'm recommending these things from experience and where I find myself getting stuck and making mistakes.

larswik
Aug 30, 2010, 01:16 AM
I just started a few months ago. I bought the book that ranguvar was mentioning and it is great for beginners and I am on page 170. The hardest part that I have had so far is the syntax. I understand how to do something with code but get lost trying to explain it to people when I need help.

So 2 days ago I paid $68 and downloaded the videos for that book, converted them to Apple TV videos and watch them and train. It's really helping me listening to him say things like "Instance Variables", "accessor methods", "setters and getters" to understand the terminology (syntax).

After I finish a section in the book / video I try to write my own different version to see if I understand it.

The book / video has been a great combo and this board helps a lot even when I ask stupid questions :)

-Lars