is objective c hard to learn?

Discussion in 'Mac Programming' started by iamamthelawl, Dec 16, 2007.

  1. iamamthelawl macrumors newbie

    Joined:
    Dec 16, 2007
    #1
    I took a course in High school a couple years ago about Visual Basics and I did pretty decent in the course. Some things confused me but I also had a pretty bad teacher, He was fired after I finished the class. Because I don't think Visual basics works on a mac, I decided to find a language that does, and a lot of people said look at Objective-c. I flipped through the apple tuto use? I am newrial on it and it looked pretty confusing being how long it was to do the currency converter. I do want to learn it though and I was wondering how hard is it to learn and to use Xcode. I just installed it and it looked kind of complicated. Are there any book or online tutorials you would recommend?
    Also what can you do in xcode? I head some people say you can use opengl and others said you can make windowed(not sure what windowed applications are called on a mac because it doesn't use windows) applications.

    Thanks a lot, I am still pretty new to this but it sounds like something I want to get into and all the courses that currently exist are only for windows.
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Personally I would (in fact I am) recommend starting off in straight C or maybe at a push C++.

    It is a much easier language to learn simply because of the wealth of good documentation available for it. For instance all the books I am using to learn C are at least 10 years old, one is 20 years old. As long as you use the -ansi option when you compile you will be fine.

    Then when you come to learn Objective-C later and then Cocoa you will find it much easier.
     
  3. steelphantom macrumors 6502a

    steelphantom

    Joined:
    Oct 15, 2005
    #3
    I'd definitely recommend Programming in Objective-C by Stephen Kochan. It's a great book and will start with the basics of Objective-C and then move on to more complicated stuff once you've mastered the basics.

    When people say you can make "windowed" applications they mean that you can create applications that have their own GUI interfaces (apps like Firefox, iTunes, etc.) instead of just basic command-line programs. Xcode is very powerful. It's what Apple uses to write all of their software!

    Hope this was helpful, and good luck on your programming journey! The people here are very helpful and will give you a hand if you ever get stuck on anything. They've given me advice many times before! :p
     
  4. Soulstorm macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #4
    The difficulty of grasping the concepts of a new language depends on the person. You will easily learn the language if you can learn the concept of Object Oriented Programming in general.

    My recommendation is to learn C++ first. It will introduce you to OOP and you will learn many valuable things, like pointer usage and dynamic memory allocation which will prove a life saver in Objective C. Do not begin with C. It is not object oriented, and it will prove useless in long terms. Learn C++ from the ground up, then move on to ObjC. Apple has great documentation upon the language.
     
  5. mduser63 macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #5
    Great advice here, though I agree with steelphantom (and disagree with Cromulent and Soulstorm) that you should just start with ObjC if you that's what you want to learn. Not that C++ is a bad language, but it's got some important differences from ObjC including some disadvantages. It's also not the best language for developing Mac programs (ObjC is). Stephen Kochan's book is the way to go IMO, and it doesn't require any previous knowledge of C or ObjC.

    Just though I'd point out that Macs do use windows, they just don't use Microsoft Windows (well actually they can...but you know what I mean). Macs had windows before Windows had windows (or even existed for that matter).
     
  6. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #6
    That C isn't not OO doesn't mean anything. OO maps well to certain programming tasks, but it isn't universal, nor need it be.

    The Mac OS X kernel, XNU, like most operating systems, is apart from the C++ IOKit and bits of assembler, written in C. And above XNU, most Darwin components are written in C.

    Sooner or later, if you want to do any serious development, you will have to reconcile yourself with C and the C API's.
     
  7. mduser63 macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #7
    My opinion is that learning Objective-C gives you enough C (ObjC being a strict superset of C and all) that it's not a problem to figure C out as you need it in the future. Of course this is coming from someone who did learn C long before ObjC and still writes about as much C (albeit as firmware) as ObjC so I'm not speaking from personal experience. I agree that C not being OO doesn't really mean anything, but OO concepts are very useful and powerful when developing high-level applications like the average hobbyist is going to be interested in.
     
  8. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #8
    I would disagree when it comes to that sentiment but you have already responded above.

    From my own experience C maps much better to other languages than ObjC even though it is a superset of C. There are important differences to the way it works and the syntax it uses. Going from C to Java or Python is pretty trivial and both are OO languages. ObjC I could imagine being a little harder if that was all you knew.
     
  9. hhas macrumors regular

    Joined:
    Oct 15, 2007
    #9
    First things first: there is Objective-C, which is a programming language, and there is Cocoa, which is a framework for constructing OS X applications. The former is roughly comparable to C#; the latter to .NET.

    You can, if you wish, write Cocoa-based applications in languages other than ObjC; for example, Leopard includes Cocoa bindings for Python and Ruby as standard. The only downside of that is that the currently available documentation almost always discusses Cocoa development purely in terms of ObjC, so in practice you still need to know a bit of ObjC (enough to read it, anyway), in order to do this.


    Second: whatever language you use, you will absolutely need to have reasonably decent object-oriented programming skills to write Cocoa applications. If you don't already have OO skills, I recommend you develop some ASAP, ideally before jumping into full-on Cocoa development. Cocoa is a very dynamic system, so a highly dynamic OO language - Python, Ruby, Smalltalk, etc. - will stand you in better stead than a relatively static one (e.g. C++, Java).

    Languages such as Python and Ruby also have the advantage of being interpreted rather than compiled, so are faster and more forgiving to learn in. With plenty of literature and community support available, you shouldn't have too much trouble picking one of these languages up. I'd also recommend reading some general programming literature if you need to sharpen your skills a bit; Steve McConnell's Code Complete is a must-have in my experience, and no doubt other folks can provide suggestions as well.


    Third: if/when you have some basic OOP experience under your belt, picking up a bit of C is also a good idea if you're going to be using ObjC. I think Kochan's ObjC book includes enough C to get you going (although I haven't read it myself), though most other books on ObjC/Cocoa development assume you already have that knowledge.

    You do need to understand C pointers (which actually aren't that hard to grok as long as you find a good, clear explanation of them to work from, although they will take a bit longer to become second nature). Other stuff like C-style memory management and string handling I wouldn't worry about beyond being aware they exist since ObjC makes its own very thorough arrangements on those fronts.


    Fourth: yeah, that first step into Cocoa is a bit of a jump. Wrapping your head around all the concepts involved takes some time and work; Cocoa really likes its abstractions. Stick at it though, and once all jigsaw bits snap into place you'll find it definitely pays off. Read around the Cocoa literature and various online resources, tinker with existing sample projects, write your own simple apps to explore individual concepts and test your understanding of them, and don't be shy about asking when you get stuck.


    Fifth: in case all of the above sounds like a lot of work and just a bit intimidating, if it's any reassurance I'm totally self-taught myself with nowt but a fine art degree by way of formal qualifications. Yeah, it takes a bit of time and sweat, but it's eminently doable and it's a pretty sweet nut once cracked.


    Finally (and maybe I shoulda just put this first... oh well): while you're correct that VB itself isn't available for OS X, there is a commercial cross-platform VB-like language/environment that is: REALbasic. So if you like VB and really want to stick with a VB-ish approach, you might want to check it out.


    HTH, and best of luck.
     
  10. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #10
    I'll approach this slightly differently. Is it hard to learn Objective-C? No. Cocoa? Yes!

    I'm a C# developer by day with a strong background in Java as well. I've been around the block when it comes to software development. That said, I've had a difficult time getting into Mac development because of Cocoa and Xcode. The tools and online help (forums, docs, APIs, blogs, community, etc) just aren't there when you compare it to C#/.NET and Java. For example, if Xcode had basic "code complete" features like Visual Studio or Eclipse, it would help programmers know what is available for them to use without searching endlessly on Google. I'm not suggesting you turn Xcode/Obj-C into Visual Basic but at least give Xcode modern IDE features that assist programmers new to the platform. All in all, the Cocoa framework is simply not as easy to follow or use as .NET or Java.

    /puts on flame suit...
     
  11. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #11
    lol.

    Xcode -> Preferences -> Code Sense will get you to turn on Code Completion, which is not on by default.

    I've been using Xcode on and off for about a year now and figured it out a month ago.

    Todd
     
  12. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #12
  13. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #13
    Thanks for the tip. Glad to see I was wrong about that. I wonder why it's not enabled by default...
     
  14. Gelfin macrumors 68020

    Gelfin

    Joined:
    Sep 18, 2001
    Location:
    Denver, CO
    #14
    Because it's a little rough around the edges. If you're accustomed to Intellisense (which itself is a little unreliable at times), XCode's autocompletion will irritate you a little, but it's better than nothing.
     

Share This Page