views:

513

answers:

16

Hello people, this would be my first question after signing up! Anyway heres my question, I did Java at university and I was always told I am a good programmer. However I never pursued it as a career - I went into support and management instead. Im pretty much bored with my job, I have therefore started to learn Objective C so that I can develop apps for the iphone. I am currently watching several different Videos / Books.

My problem is that when I go through the Apple documentation, although I understand most of it, sometimes I stumble. I believe that because you/we have the Apple documentation (i.e. Framework references) , everything should be clear, and therefore you should have no need to refer to a book or video (in order to learn how to use a particular class). But I alway do refer to a book and video and subsequently feel guilty as I believe the framework reference should be enough. (I therefore feel I am not up to being a programmer)

I also believe that you shouldn't need example code in order to learn how to use a particular class because Apple provides documentation for each class, but AGAIN I find my self googling example code and I find my answer like that - again I feel guilty for doing this.

Am I right in saying that Apple documentation is simply not clear? and that its ok to refer to a video/book or google? or forums for that matter?

I have proffesional programmers who tell me that I am worrying too much and that I should get on with it and use all the resources that I have. I just cant seem to get round this mental block that I have in my head.

When I start a programming project I am able to use the excellent search skills that I have to find the code I need, copy and paste it (yes I do understand it) BUT then I feel guilty telling myself that why didn't you think up the code yourself???? Therefore your not a real programmer, your just good at googling.

Currently I am going through 20+ books so that I can learn most of the frameworks, syntax etc to develop iphone apps. I believe if I do this, then when I think of a project I can make it quickly. Should I read a few books, like 2-3 and then just start a project /app , and if I get stuck just google it and get the code I need?

Can anybody please answer my questions?

Edit:

Absolutely BRILLIANT answers and comments received from everyone. I am most grateful.

From now on I will use all the forums, books, documentation and example code I need without feeling guilty! As some people have said, Apple docs are not clear (and YES, I am very familiar with Objective C Syntax). I'll give you an example: In order to make the keyboard go away on the iphone, you have to use a method called resignfirstresponder. I learned how to use this method from a Video tutorial!

There is no way in hell that you can learn that from Apples docs, and sometimes not even from the best of books (the method is rather weird the way it works, the Apple docs are not clear).

Thats my gripe - Apple docs should be clear (at least with some example code). It seems people who are good programmers (but not good at googling) lose in this arena. And it seems not so good programmers can still get by - just by googling or watching a few videos (which a professional programmer does/cannot have access to for whatever reason). The whole affair seems rather unjust and imbalanced if you ask me.

Thanks for your replies people.

A: 

Learning to program is a lot more than just memorizing a language or framework - there are things like data structures, algorithms, design patterns, etc. that will apply to many languages that are the true building blocks of (good) programming.

AbeVoelker
+10  A: 

It's perfectly acceptable to understand the documentation, and still need to see how to use it. It's like for instance, I can tell you what "code" means, but without context, it's hard to imagine how to use it properly. I mean, you know what it means, but how exactly do you use it?

I've been working with Objective-C since the early 1990s with NeXTSTEP and I still take a look at sample code when a new framework is released, or whatnot. Why? Because it saves me a lot of time, and context is important.

jer
A: 

Think of the framework documentation as a dictionary, and the example code as an encyclopedia. You need to reference both, but each for different reasons.

anthony
A: 

Everyone learns in their own way. Like you, I prefer (working) examples to reading the API documentation. But that goes for every language I use.

I think you're worrying about other people too much. The important thing is that you figure things out eventually, and while you're using different references, that you're getting the job done. Who cares if other people learn differently than you do?

Shaggy Frog
+3  A: 

I'm not entirely sure what your question is. You have a "mental block" that makes you feel "guilty" because you can't master a new technology from just reading the reference manual? That sounds like a personal issue, and it's not going to be possible for anyone to come up with a short written answer which will cause it to go away -- especially if you've already been told the same thing by other "professional programmers".

Anyway, FWIW, the Antimoon people maintain that the example usage is more important than the definition, and I'm inclined to agree. You didn't learn English by sitting around reading dictionary definitions. For that matter, you don't learn to drive by reading your car's technical reference manual. You don't learn to walk and run by studying anatomical diagrams of leg muscles. I don't know why people think that computers are somehow special in the field of human endeavor that the way you learn them should be completely different from everything else you've ever learned, ever.

Ken
A: 

Apple's documentation is not very well organized nor complete, in comparison to what Sun did with Java and Microsoft did with .NET. Apple tends to provide very simple (too simple to be useful) tutorials, and then detailed reference materials, but nothing to bridge the gap. They also tend to split related information across multiple documents.

So, I think third-party books are a must to get a high-level overview of how everything fits together, and how to do the basics. Also, study all the sample code you can find. Even though you are most interested in iPhone programming, look at some of the Mac OS X samples to see some of the basics.

Ultimately, you just have to dive in. Pick one application feature you want to implement, and do the necessary struggling to get it to work. Ask questions on SO and elsewhere. Continue this, and eventually you won't feel so lost.

Kristopher Johnson
+5  A: 

Some concepts from natural language learning may be relevant here.

You can distinguish between receptive language skills and productive language skills. Receptive skills involve listening and reading a language. Productive language skills involve speaking a language. If you spend a lot of time studying a language on your own, and haven't yet generated a lot of material in this language, you can find yourself good at receptive skills but not so good at the productive ones. It may be that you have thoroughly learnt all of the rules of grammar. And that when you struggle to write a sentence, and someone helps you, you find that they didn't use any principles you didn't already know. Nonetheless, it can still be heard to product when only your receptive skills are good. This may be where you are with Objective C. Sounds like you can read the language fine, but it takes more practice to be able to write it.

That said: There's also a lot unsaid in the Apple documentation. For example, most Apple Objective C function documentation doesn't tell you who owns the memory of the returned values. This is because they implicitly tell you through a naming convention. If you haven't read the documentation on this then it looks like something is missing from the individual function docs.

Another difficulty, related to the receptive/productive thing, is that there are many different ways to organise an application. But the Objective C library is geared towards a model/view/controller approach. If you aren't aware of this approach, and you launch into Objective C code, then no matter how well you know the language you'll find your requirements rubbing up against what the docs expect your requirements to be.

I should also add: the Apple documentation looks nicely professional and laid out but I think that there is a ton of information that is hard to get at. For example, I've had lots of trouble trying to figure out the precise order in which various stages happen during the launch of an application finding lots of ambiguous (or maybe even incorrect) statements scattered in different places.

So I suggest grabbing whatever resources you can to help you. You don't learn a natural language by simply rote learning the grammar. It's hard to learn a programming language that way too.

It's so funny that everyone is so sure that "you don't learn a natural language by simply rote learning the grammar." It's true, but rote learning the grammar and knowing the fundamentals from A-Z perfectly gives you a huge head start. I can only speak for learning natural languages. In programming languages I've never been so systematic.
Yar
People are sure for the simple reason that most of us have studied more than one language and so can draw on our own experience.
+10  A: 

Someone once said:

"We learn by doing, there is no other way".

I firmly believe this with coding too. Read less, do more, then read when you get stuck. In my opinion, that's the best way to learn any new language.

rein
+2  A: 

I was an experienced Java programmer before taking on the iPhone SDK a couple of years ago, and I think Apple's documentation is among the clearest I've seen in my career.

I think your problem is that you are spending too much time reading books and documentation. You already have a programming background, so learn by doing. Start with the Your First iPhone Application tutorial, so that you get down the basics of Objective-C, MVC, and Interface Builder. The "Where to Next" suggestion has tips on what to try afterwards. After that, you probably will at least have a good enough starting knowledge base to build your own app idea, or at least how to get started.

bpapa
+4  A: 

If you think a particular class will solve your problem, you should scroll up to the top of the class documentation and read through the related Companion Guides. The guides provide -- through documentation and example -- the various standard patterns of use most expected for the class.

Example: NSString's class documentation provides precise definitions of the behavior of various NSString methods while the companion guide describes how to perform all kinds of tasks with strings.

And... what rein said.

(I also find it funny when people claim that Java's or .NET's documentation is so much better -- from where I am, I find Apple's documentation far superior. I fully and completely admit that is because I have Cocoa experience while my Java has languished and I've never dove deeply into .NET.)

bbum
+3  A: 

Step 1: Relax

Step 2: You gotta understand that this is not easy stuff to master. That is why people who do get paid really well. If you had an idea you could bang this stuff out in a couple of weeks with you need to dump that. Plan to spend months working up on it.

Step 3: Understand that the Apple API is HUGE and it is always evolving. I've been working with it since the Mac-Classic/NextStep era and everyday I learn something new.

Step 4: The fewer programming languages you've had to learn, the harder it is to learn new ones. You will learn slower than someone else who has learned half dozen languages/APIs already.

Step 5: Don't be afraid to use repetition and brute force. I think the thing that slows novices down is not learning the behaviors and methods of common foundation classes like NSString, NSArray, NSDictionary etc. Break out the flashcards.

Step 6: Relax

TechZen
Very good comments, but I dont Step 2: has lots of typos / mistakes.
A: 

I could understand the problem and sometime it's possible feeling the sensation of "unreadiness".

Obj-c can be frightening at first sight and the best way is to try writing some easy simple problems's solutions and go ahead by little steps.

Dario
+1  A: 

I think it would really benefit you to read Cocoa Design Patterns by Erik Buck. Once you start to see the patterns behind the frameworks, you start being able to anticipate how things will work through naming patterns and logic.

Jeff Kelley
A: 

The Apple documentation is just a reference really, it's not a compendium of everything so you should use it as a 'starting point' for your learning and then build on it from there when searching elsewhere.

There's nothing wrong with using google to find the answer to your questions

djhworld
A: 

I studied software development in college and had several friends who were music majors. They had classes where they were assigned to listen to a range of music so they could understand the different approaches and qualities of each kind of music. It gave them depth for when they would write their own music. You can only get so far from learning from just the documentation on the parts. Inspiration from others will surely help you produce better work.

Also consider that authors also learn to write better content when they read work done by the best writers.

A prominent programmer in the Microsoft side advocates for what he calls "code reading" where you pick out an Open Source project that you believe is a good example of quality code. You go through it and figure out how it was put together and why. You can see more here...

http://www.hanselman.com/blog/TheWeeklySourceCode41SearchingCodeSharingCodeAndReadingCodeAndComments.aspx

I also like to look at the source control history on specific files to see how the code has changed over time. I find the other developers make the same mistakes I do when I first start working in an new area. If you can benefit from learning from the mistakes of others so that you do not repeat them yourself, you will be a better programmer for it.

Brennan
+2  A: 

Am I right in saying that Apple documentation is simply not clear?

No. It's simply that the documentation is not designed for absolute beginners at Objective-C.

and that its ok to refer to a video/book or google? or forums for that matter?

Yes. Use any resources you like. There are no rules on how you should learn.

When I started learning Objective-C I was an experienced programmer in C, Java and C++ as well as several other languages, so I was starting from a better position than you are. I tried to learn the language and Cocoa from the Apple docs but found it impossible. Just finding where to begin is a huge hurdle if you don't know anything about the language. For instance, the memory management guidelines are quite straightforward and easy to understand, but as a Java programmer it probably wouldn't occur to you that you even need to look for them.

I found the best way to learn Objective-C was to read a book that claimed to teach it. I chose Aaron Hillegas's book but there are others.

BUT then I feel guilty telling myself that why didn't you think up the code yourself?

As a learning exercise, copy-pasting might not be the right thing to do. However, there is absolutely nothing wrong with it in general (copyright issues aside, of course). If there's an Apple example of how to do something, rather than copy-pasting I tend to rewrite it manually. I find it sticks better in my mind, but everybody is different.

JeremyP
Totally agree on typing code samples by hand. Somehow it 'sticks' better.
willc2