Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My mental block - struggling to learn Objective C

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.

like image 245
user365426 Avatar asked Jun 12 '10 22:06

user365426


People also ask

Why is Objective-C so hard?

Objective-C is a very different language with regards to its syntax. It's so different, even, that most people don't look at it long enough to realize that the semantics of the language are almost identical to C++, Java, or others.

Is Objective-C still used in 2022?

There are a lot of indicators telling us there's still a ton of legacy Objective-C code, both from Apple and from other developers, that's still in use.

Should I learn C before Objective-C?

Absolutely – you can learn Objective-C without knowing C. And in fact, if you're interested in learning to build iOS apps, you should just learn Objective-C first – it'll get you there much more quickly than learning C first, then Objective-C, then the iOS frameworks…


4 Answers

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.

like image 86
rein Avatar answered Oct 13 '22 20:10

rein


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.

like image 26
jer Avatar answered Oct 13 '22 18:10

jer


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

like image 29
TechZen Avatar answered Oct 13 '22 20:10

TechZen


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 hard to produce 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.

like image 35
sigfpe Avatar answered Oct 13 '22 19:10

sigfpe