I want to make Cocoa apps--which language?

Discussion in 'Mac Programming' started by jamdr, Oct 9, 2005.

  1. macrumors 6502a

    jamdr

    Joined:
    Jul 20, 2003
    Location:
    Bay Area
    #1
    I should start by saying I don't want to bother learning Obj-C. I'm sure it's a great language and everything but I primarily use Java and C++ and platform portability is important to me. I just don't see the point of learning another C-variant language when it's only used on a single platform. I was going to try out Cocoa-Java but apparently Apple has discontinued it since Tiger. Where does that leave me?

    Basically I just want to be able to use IB for my GUIs ;)

    Someone recently made me aware of something called AppleScript Studio, which lets you build full-fledged applications with AS! Well, I used to use AS all the time back in the days of OS9 so I don't think I'd have to learn a whole new language (unless it's changed that much). The kinds of applications I'm going to be developing are pretty simple, but it's absolutely necessary for me to have solid XML support. Does ASS have a good XML parser built-in? Thanks for your help.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Learn Obj-C. It takes 2-3 hours if you can already write C.

    ASS is a little slow and does not have access to everything that you can access through Obj-C.

    You could start off with ASS and then move on to Obj-C I suppose. Cocoa-Java still works, it's just unlikely to get access to some of the funkier new stuff like CoreData...
     
  3. thread starter macrumors 6502a

    jamdr

    Joined:
    Jul 20, 2003
    Location:
    Bay Area
    #3
    Yeah, I knew someone would say that. It is just my understanding that Obj-C is like C++ but worse. When I look at Obj-C code it just looks like a mess and it is not obvious to me at all what everything does. If ASS is slow maybe I can just use C with Cocoa? Is this difficult to do?
     
  4. macrumors regular

    Joined:
    Apr 16, 2003
    Location:
    Minneapolis, MN
    #4
    Well, you'd be missing out if you believe that it's confusing just because you haven't learned it yet. That's to be expected. Most every code style is confusing until you glean it's purpose.

    Obj-C is a strict superset of C. Everything you've learned in C is available to you. However, Obj-C's object syntax allows for some of the most readable code, IMHO. Couple that with the Cocoa frameworks and you get tremendous functionality in an elegant set of frameworks. I absolutely love it and am really enjoying coding again.

    If you're comfortable coding in other languages, I invite you to dig in for a week or two. I can't imagine your confusion will last very long.

    Best,
    Logicat
     
  5. macrumors regular

    Joined:
    Sep 12, 2005
    Location:
    SE London
    #5
    there's also the fact that applescript studio is a commercial product that you have to pay for, whereas xcode and interface builder are bundled with OS X
     
  6. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    No it's not. ASS is bundled with XCode.
     
  7. macrumors 65816

    devman

    Joined:
    Apr 19, 2004
    Location:
    AU
    #7
    Well I guess you'd have to define "worse."

    As far as looking like a mess - I'm surprised how this comment comes up from time to time. There's no real syntactic sugar or ugliness in Obj-C. The major difference is in the syntax for method calls.

    But, frankly this is all missing the big picture. If you want to do Cocoa development for OS X then Obj-C is the only place to be.
     
  8. macrumors 65816

    devman

    Joined:
    Apr 19, 2004
    Location:
    AU
    #8
    What do you mean by platform portability? If you mean the app then Cocoa and AS are out of the picture. You'd go with 100% pure Java.

    If you mean just your language skills, well AS is also just as single paltform.

    Doesn't make sense.

    If you're already proficient with Java and C++ then robbieduncan is right - you'll pickup Obj-C in 2-3 hours. There's little syntactical difference. All your time will go to learning Cocoa and the other OS X frameworks.
     
  9. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #9
    Just noticed this direct question. If you are going to be working with XML a lot then Java is probably a good fit. As far as I am aware ASS does not handle XML very well at all. You'd probably want to call across the bridge into Obj-C for this!
     
  10. macrumors member

    Joined:
    Jul 8, 2002
    #10
    I agree with everyone else... if you want to make an app for Mac OS X, Objective-C is the way to go. I think it's far simpler than C++.

    Objective-C looks a bit funny at first because you use brackets to make a method call instead of "->", but you'll get used to it quickly. There are a few memory management differences, but those aren't too tricky either.

    And Objective-C has nifty dynamic runtime binding.
     
  11. macrumors 6502a

    #11
    Python

    Have a look at Python / PyObjC.

    1. It is a very useful language in itself and will complement your C++ and Java. It is vary easy to pick up, too and is pre-installed on OS X.

    2. The language has bindings for hundreds, if not thousands, of libraries and APIs (including several xml modules, both built in and optional extensions). Examples (I have personally used in the last month) include Linear Algebra, OpenGL, CGI, MySQL, Image Processing and Libxml2.

    3. It has superb Cocoa bindings, including (nearly) all of the latest features, in Apple's own words: "Today, you can build native, uncompromising, best-of-breed Mac OS X applications using only Python"link.

    4. As it is developed out of (Apple's) house, being a sourceforge project, and pre-dates OS-X, it is extremely unlikely to be dumped.

    5. Development is much faster than with ObjC.

    And probably some other stuff, too, like Jython (integration of Python into Java) if Java floats your boat ;)

    It is not without drawbacks:
    Integration into Xcode (or other IDEs) is not that great.
    You need to reference Java or ObjC documentation.
    Obviously processor intensive tasks take a hit with an interpreted language (Python can easily wrap your own C or C++ code).

    And probably some other stuff here, too.

    You might also want to look at Ruby, which again has Cocoa binding but I am in no position to comment on those.

    €0.02 on ObjC: if C++ to you means mostly polymorphism, you will be fairly happy and can enjoy the (imho preferable) function calling syntax. If C++ to you means templates and strong typing, then you might be in for a shock. I use C++ mostly with shallow class hierarchies and lots of templates and have no doubt at all in saying that ObjC has more in common with Python that C++. YMMV, as they abbreviate.
     
  12. macrumors 65816

    devman

    Joined:
    Apr 19, 2004
    Location:
    AU
    #12
    Excellent points re: C++. In fact, the dynamic-runtime model vs static-strongly typed applies to anyone coming from Java too (yes, I know about Class.forName and etc.).
     
  13. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #13
    I came to objective-C from a procedural, strictly typed programming background so OO took a while to get my head around and I still pretty much type everything as strictly as I can (if only for code completion purposes) but there are times when dynamic typing is a real godsend.
     
  14. macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #14
    You can use obj-c in Linux, and Windows with GNUStep.

    Obj-C is not another variant of C, IT IS C.
    Objective C "objects" are just structs with methods that are just pointer to functions... [object doSomething] just evaluates to objc_msgSend()...

    If you already know C++ and Java, Obj-C will take you less than 30 min to get. Why don't you read the Objective-C manual, it'll take you less the 30 min to get through and come back and see if you still want to use C++ (which you can by the way in Obj-C++).

    P.S Its not Obj-C you should be worried about learning, its the Cocoa APIs
     

Share This Page