Shall I learn C before learning Objective-C

Discussion in 'iOS Programming' started by KeeeeenW, Oct 26, 2010.

  1. KeeeeenW macrumors member


    May 19, 2009
    Hi guys,

    Probably you guys have seen this a thousand times but I just want to ask shall I learn C language before moving to Objective-C?

    I've studied JAVA for one year in my high school but I could not follow the iPhone Developer Courses from Stanford, because I could not understand some syntax and concepts which I believe are derived from C.

    If I should learn C first, what's the best book I can buy?

    What should I do after learning C?(Check out the iPhone Courses again? Or learn Objective-C language? )

    Thanks XD
  2. kainjow Moderator emeritus


    Jun 15, 2000
  3. kayloh20 macrumors regular

    Apr 8, 2010
    Chicago, IL
    I'd say dive right into Objective-C.

    I only had a year of Java in high school and still was able to grasp iOS development (though it took me a few months because I was on my own).

    Unless you're going for lower level programming, C won't help you too much. I'd actually go as far to say that a Java background is more useful than C in terms of iOS development.
  4. KeeeeenW thread starter macrumors member


    May 19, 2009

    Ok...Thanks... That encourages me a lot!
  5. KeeeeenW thread starter macrumors member


    May 19, 2009

    Thank you for your recommendation. I've checked out the book on the Amazon. Do you know when the author is going to release the 3.0 version?
  6. rkmac macrumors 6502


    Jun 22, 2009
    JAFA, New Zealand
    Programming in Objective-C came out in 2003
    Programming in Objective-C 2.0 came out in 2009

    if one assumes that he has a 6 year gap between publishing editions of his books, you are looking at 2015 :rolleyes:
  7. KeeeeenW thread starter macrumors member


    May 19, 2009
    Ok~ haha
  8. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    I suggest learning the basics of C first, especially all the data types, control structures, and the use of pointers, but moving on to Objective-C before writing any big applications.
  9. KeeeeenW thread starter macrumors member


    May 19, 2009
    Thanks for your advise!
  10. Bernard SG macrumors 65816

    Bernard SG

    Jul 3, 2010
    What firewood said.
    You don't need to learn C extensively, but understand the fundamental concepts, the syntax and the basics on memory management, very important, especially as you come from Java where that's basically a foreign concept.
  11. jll63 macrumors newbie

    Nov 6, 2010
    Why not Smalltalk ?

    If you insist on learning another language before delving into Objective C, maybe Smalltalk is a better choice ;-)

  12. North Bronson macrumors 6502

    Oct 31, 2007
    San José
    C isn't a very big language. If you exclude the function libraries, it's entirely possible for anyone to know the whole language backwards and forwards.

    If you just skip the C and go straight into Objective-C, there are going to be times where things look unfamiliar or intimidating. If you build a Cocoa app and you ever have to work with Core Graphics, Core Foundation, the Address Book, or any other lower-level APIs, you'll be glad that you're good with C.
  13. pinsrw macrumors regular

    May 30, 2010
    Learn C first. It's the language that ObjC was built upon. If you don't have a good grasp of it there is the risk that you will become too reliant upon ObjC's conveniences, in the way that C++ programmers do. People who learn OOP languages first are at greater risk of becoming sloppy. Always learn procedural programming before OOP.
  14. yaniv92648 macrumors member

    Oct 26, 2009
  15. Giuly, Nov 14, 2010
    Last edited: Nov 14, 2010

    Giuly macrumors 68040


    And that's totally OK in 2010. If you're going to code for iOS and Mac OS X, it's probably more important to know about OOP stuff like classes, protocols and delegates rather than "waisting" your time figuring out how a C pointer works. Remember, iOS has no garbage collection you could be lazy about anyways and encourages you to care about your memory management. Or the concept behind table cell reuse, you can apply that to pretty much anything.

    Once you hit CF or AB, you'll dive into C anyways - even if they're pretty much Obj-C-like, as even those have convenience functions like XYZCreate() and XYRelease() rather than malloc and free.

    Go for Obj-C, chances are you'll never need "proper C". If you do, grab some "C Compact Reference" and read. As you'll be already familiar with basic terms, it'll be much easier to understand than doing it from scratch. Yes, you'll be screwed up by Obj-C, but that doesn't seem like a big deal, unless you expect Apple to go out of business soon.

    Oh, and digg this. (Or this, whichever you may prefer)
  16. bdormer macrumors newbie

    Nov 15, 2010
    C isn't your problem

    I'm taking the Stanford course myself. I know C, C++, C# and Java (among others). If you are having problems with the course content and know Java (or some other C derivative language) - you PROBABLY don't have a problem understanding the syntax (Objective-C and Java are "close enough" that you should get the C parts of the language without too much trouble). The non-Java/C parts of the language are taught in the class.

    What's probably throwing you is the object oriented stuff. The instructor even says that right at the beginning of the first class. Get a book (or take a class) on Object Oriented Programming/Design. If you don't know what terms like: Class, Object, Instance, Instantiation, Inheritance, Interface, Implementation, Message, Method, Member Variable, Constructor, Destructor, Garbage Collection and Polymorphism mean - then you will be way behind the curve. And in this class - you won't survive long if you fall behind.

    I think Smalltalk would just confuse you - O-C has SOME Smalltalk in it - but if you can read Java syntax, you should be fine. Concentrate on the OO concepts.

    That being said - the course is not for the faint-of-heart. The instructor doesn't spend a whole lot of time on any one point - he gives you the concept, then moves on. If you space out for 5 minutes during the lecture - you better back up and find out what you missed (thats what the rewind button is for). The assignments take 4-6 hours if you are really good (or lucky). The extra credit items can push that time up quite a bit. This is a class for hard-core Computer Science geeks (with a GPA high enough to get into Stanford)- techno-wimps and wanna-bees need not apply. When you complete this class - you'll know what you are talking about - but you're going to have to work hard to get there.
  17. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Unless the programmer needs to debug their way out of a subtile typo (which can still occur in the C portion of an "all" ObjC app), or a memory, CPU performance or battery life problem occurring at some lower level.

    I've seen some pretty serious time-wasting screw-ups from programmers who thought they could get by, writing large non-trivial applications, but knowing only the high-level "good parts" of a programming language.

    Don't be the next one.
  18. Giuly, Nov 15, 2010
    Last edited: Nov 15, 2010

    Giuly macrumors 68040


    IIRC, it only requires CS106B, which should be Programming Abstractions.

    CS106B is about C/C++ though, so you'd learn those basics first.

    I'd rather suggest to have a look into Programming Methodology (Tells you what stack and heap are, pointers, … so you rather need that one for proper debugging), Programming Paradigms and the Programming Abstraction courses. These are pretty much the main programming introductory courses in the computer science department of Stanford. The MIT has pretty good courses on iTunes-U, too, but these really blow your mind. Introduction to Computer Science and Programming is pretty helpful to take a look at, though. This is concrete stuff that really matters.

Share This Page