iOS Learning Objective-C from C

lynkynpark86

macrumors 6502
Original poster
I've wanted to learn Objective-C since I learned what it was about 3 years ago. Many, many, many, many, many details removed, I can't do anything more advanced than Python on my Mac. If I learn C or C++ on my Windows machine, how much will it help me (eventually) learn Objective-C? From 1-10, 1 being "It will help me as much as knowing German", and 10 being "They're the same language"...
 

larswik

macrumors 68000
Sep 8, 2006
1,552
11
I bought the book Learn C on the Mac and read that first, great easy book to learn from. I took my time and created my own examples from the examples in the book so it set it. by the end of that book I wrote a really poor looking, but working console blackjack game.

C is a good place although many people have different opinions as to how to approach it. I started the C book in September 2010 and wrote the blackjack game over Christmas that year. one year later I am well into Objective C but still learning since learning never stops.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
If you don't know some C it will be difficult to learn Objective-C. You don't have to be an expert though.

If you were an expert in C++ it would help you to learn Objective-C, since you would already understand OOP. However, if you don't know either one and your goal is to learn Objective-C I wouldn't spend any time on C++.

I would recommend looking at the Kochan book. I believe that it starts you off at the beginning and takes you through Objective-C. Maybe someone who has done it this way can comment. I recommend you read the user reviews of it on Amazon.
 

mduser63

macrumors 68040
Nov 9, 2004
3,039
30
Salt Lake City, UT
Why not learn just start with Objective-C on your Mac? Objective-C is a strict superset of C, so anything that's valid C is valid Objective-C. That said, Objective-C is for writing object-oriented programs, while C is for writing procedural programs. What that means is that while Objective-C contains all of C's capabilities and syntax, you don't actually use the strictly C stuff too much.

C++ is object oriented like Objective-C, but they're fairly different languages. Learning any object oriented language will make it so you understand the basic concepts/theory behind object oriented programming (OOP), but to be honest, if your goal is to learn Objective-C, learning C++ first probably isn't really the way to go.

I think Stephen Kochan's book is an excellent way to go. It teaches you Objective-C without assuming you've ever programmed before, so there's no need to learn C or any other language first.
 

firewood

macrumors 604
Jul 29, 2003
7,837
1,089
Silicon Valley
Knowing C will make an Obj C programmer a better Obj C programmer. However knowing C will not automatically make a person into an Obj C programmer. For that one has to learn OOP semantics and object oriented design patterns and methodologies. And spend a couple weeks getting used to new weird punctuation (brackets and such).

If you know how to do modular and event-driven programming in C, that will give you a big head start in learning Obj C for Cocoa or iOS.
 

balamw

Moderator
Staff member
Aug 16, 2005
19,366
978
New England
I think Stephen Kochan's book is an excellent way to go. It teaches you Objective-C without assuming you've ever programmed before, so there's no need to learn C or any other language first.
Hillegass' new book also assumes no foreknowledge and teaches C in ~80 pages.

B
 

Sydde

macrumors 68020
Aug 17, 2009
2,148
4,570
IOKWARDI
if your goal is to learn Objective-C, learning C++ first probably isn't really the way to go.
I have to strongly agree with that. Having seen some of the difficulty that C++ programmers tend to have adapting to the Objective-C paradigm, I think it would benefit one more to go in the opposite direction, if necessary. C++ might be a useful, marketable tool in one's bag, Objective-C would provide a good base for learning it.
 

lynkynpark86

macrumors 6502
Original poster
Why not learn just start with Objective-C on your Mac? Objective-C is a strict superset of C, so anything that's valid C is valid Objective-C. That said, Objective-C is for writing object-oriented programs, while C is for writing procedural programs. What that means is that while Objective-C contains all of C's capabilities and syntax, you don't actually use the strictly C stuff too much.

C++ is object oriented like Objective-C, but they're fairly different languages. Learning any object oriented language will make it so you understand the basic concepts/theory behind object oriented programming (OOP), but to be honest, if your goal is to learn Objective-C, learning C++ first probably isn't really the way to go.

I think Stephen Kochan's book is an excellent way to go. It teaches you Objective-C without assuming you've ever programmed before, so there's no need to learn C or any other language first.
I don't have any administrative access to my Mac. Is there a way to use objective-C on Mac without xcode or gcc?
 

Carl Sagan

macrumors 6502a
May 31, 2011
602
14
The Universe
I bought the book Learn C on the Mac and read that first, great easy book to learn from. I took my time and created my own examples from the examples in the book so it set it. by the end of that book I wrote a really poor looking, but working console blackjack game.

C is a good place although many people have different opinions as to how to approach it. I started the C book in September 2010 and wrote the blackjack game over Christmas that year. one year later I am well into Objective C but still learning since learning never stops.
That's heartening to hear, I've just bought the very same book for the same reason to eventually learn Ob C...:)
 

balamw

Moderator
Staff member
Aug 16, 2005
19,366
978
New England
Sure. But these tools are pretty much useless to a learner without Apple's libraries and frameworks.
Definitely more useful for C/C++ (and FORTRAN/Pascal) than Obj-C, I agree.

FWIW the real Apple compilers are available here: https://github.com/kennethreitz/osx-gcc-installer without Xcode. For those learning to use Foundation Kit from the command line this should be enough. However I believe the installer still requires admin privileges, so is not a solution for the OP.

B
 

Sydde

macrumors 68020
Aug 17, 2009
2,148
4,570
IOKWARDI
The big problem with not having admin access is debugging. I use a user-level account almost all the time, and when I try to launch a debug build with breakpoints, it asks me for admin privilege (username and password) the first time.

Granted, you can do a fair bit of debugging with NSLog reports in place of breakpoints, but when it gets complicated, nothing substitutes for being able to step through your code.
 

firewood

macrumors 604
Jul 29, 2003
7,837
1,089
Silicon Valley
There is an OS X command-line incantation which an admin can use to give a non-admin user just debugging privileges. I develop Mac OS apps from a non-admin account to keep me from screwing up my or bricking my Mac accidentally.
 

francis21

macrumors member
May 2, 2011
72
0
Mississauga, ON, Canada
If you are just starting with Objective C, but have some backgrounds with most of the things about OOP, then you can probably start with Objective C. However, there is a catch: there are some concepts such as memory management, etc. that have originated with C.

Right now, in my current situation, with the book that I bought called The iOS 5 Developer's Cookbook by Erica Sadun (which is, by the way, I really good book for iOS programming), it talks about memory management with Core Foundation, and just the overall concept of memory management was just really hard for me to grasp the idea.

My situation just goes to show that there are some concepts that requires C knowledge (obviously Obj. C is a strict superset of C).

So my two suggestions are:

1) If you have a pretty good solid foundation of Object Oriented Programming and some languages that implement OOP (e.g. Java), then you can get-by starting with Objective C right away. Your knowledge of such language will help you somewhat to learn Objective C, but many ideas are new there so watch out for that.

2) If you don't have enough knowledge about OOP and have not looked up OOP-based languages, then I suggest going with C first then learn some OOP concepts, then start with Obj. C. Many books will guide you through the concepts of OOP, so you'll be able to start programming with Objective C in no time.

Hope this helps. Cheers. :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.