C++ or Objective-C?

Discussion in 'Mac Programming' started by Aikiman, Dec 21, 2009.

  1. Aikiman macrumors member

    Aikiman

    Joined:
    Jan 24, 2008
    #1
    By trade Im a SFX artist with basic coding knowlegde using a precompiled langauge called mel, Maya's embedded langauge. Currently Maya on the mac is only 32bit and it is only a matter of time before it becomes 64.

    My first question is, will this mean the 64bit software will most likely be written using Objective-C and Cocoa? Or will it most likely still remain in C++?

    The reason why I ask is that Maya is completely open source which allows developers to build onto the software based on their requirements which means that currently all code is written in C++ and because of this, C++ is my first choice language to learn over the next 12 months....or is it?

    Over the last 3 releases, Python has been integrated into Maya giving technical artists access to Mayas API much like C++ does, however most plugins are still written using C++ as it is still faster than Python. Python on the other is easier to learn and offers more power than Mel.

    So my delimma is, do I invest money and time into learning the basics of C++ or should I forget that and go for Objective C?

    My other interest is programming for games but I am a total Mac fanboy and have no desire to develop for PC. Does this mean most of the books on game programming in C++ are are waste of time?

    Thanks for your time.
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    Objective-C is unlikely to ever be used as a scripting language for applications, it's used for writing the applications themselves. Maya may someday be re-written in Objective-C Cocoa but I wouldn't hold my breath for it to be supported as a scripting language. C++ and Python are much more useful there (also Javascript for scripting Adobe apps).

    As far as programming games go, you can certainly program in C++ on the Mac. Since games usually have hand-rolled UIs, you probably won't use Cocoa much there anyway. But you will require a graphics language/API to use inside C++ such as OpenGL, SDL, etc. Or use something like the Unity engine and do your accessory code in C#, Javascript, or Boo (a variant of Python).

    So yeah, bottom line based on what you said you want to do (Maya scripting, games programming), I would probably recommend you stick with C++. Personally I can't stand C++ but it is suited to what you want to do. Python would also be very useful for any number of things and it can be a lot simpler to get something running fast than with C++.
     
  3. Aikiman thread starter macrumors member

    Aikiman

    Joined:
    Jan 24, 2008
    #3
    Hey thanks man, I appreciate your feedback. Im self taught so Im a bit of a noobie when it comes to which language is responsible for what but Im getting there slowly.

    Im really loving the simplicity of Python and want to take my studies further, actually Python has also been a great introduction into the world of oop so with the right book, I ought to pick C++ up and run with the basics.

    I know that Objective C is not a scripting langauge and that it is used to build apps but which apps and how big? I do not know really. Sounds like even when Maya becomes 64bit it will still be written in C++? Hope so, because Im about to spend some money on some learning material ;)

    PS Long live the Pixies. ;)
     
  4. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #4
    There's nothing inherently non-64-bit about programming in C++ on the Mac. The confusion lies in the fact that Carbon has been deprecated and will not be ported to be 64-bit. Carbon has been the API of choice for C++ programmers because its interface is C which is much more easily compatible with cross-platform C++ than is Objective-C.

    In order to make a cross-platform C++ program 64-bits on the Mac, you'll basically need to create a C++ wrapper around the Objective-C user interface (see wxWidgets).

    http://baltazaar.wordpress.com/2009...x-and-mac-plus-answer-to-64-bit-mac-question/



    I've met a few people who hate C++, but I've never met someone who is skilled with C++ who hates it. Just to name a few things Objective-C lacks: function overloading, operator overloading, const-ness, references, templates... Of course, there are a few things Objective-C has that C++ doesn't, and so on. Ultimately, it can come down to the conventions you've grown accustomed to programming with. I've spent much more time programming in C++ (four years on the job), so I'm intimately familiar with its tools, whereas I only spent six months (seven years ago) actively programming in Objective-C. Even what I learned back then was only topical.
     
  5. rossipoo macrumors regular

    Joined:
    Jun 7, 2009
    #5
    My understanding is that since 64 bit apps require Cocoa, the interface may need to be rewritten in ObjC, but only the interface. Most of the code would not be changed. If you are into modifying the code for Maya, then it is possible that you would see some ObjC, probably unlikely, but I guess it depends in the types of modifications you'll be doing.

    Plugins are probably the same story, many may work without changes, but some might need to have a bit of ObjC added to them.
     
  6. GorillaPaws macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #6
    There's nothing about Objective-C that inherently limits how big your app can be. Apple has re-written most of their apps as Objective-C Cocoa apps for Snow Leopard (I know iTunes is a notable exception however). One of the things that makes Objective-C such a wonderful language is it's ability to play nicely with large frameworks.

    With large legacy apps, such as Maya and Photoshop, you'll find that they "roll their own" for most tasks and therefore won't take advantage of Objective-C's core strength. In Maya's case, I assume that they've got a huge codebase that's been well-tested and is functioning in C++. Any re-write will likely introduce tons of new bugs.

    It does sound like C++ is the way to go for your interests. I don't know it myself, but I've read that it takes a long time to truly master, but can be very powerful once you do. Should you ever want to lean Objective-C, it really isn't that tough, and I would think it would be pretty easy to pick up if you already know C++. Good luck.
     
  7. Aikiman thread starter macrumors member

    Aikiman

    Joined:
    Jan 24, 2008
    #7
    Okay then that settles it for me. AFAIK Maya's complete interface is built using mel anyway so when it does go 64, I would assume it would remain the same architecture.

    Im really looking forward to learning C++, Im not particularly concerned about mastering it as such at this stage. I think time will tell where I go with it, initially it will be discovering Maya's API and then perhaps games.

    Thanks for all your comments.
     
  8. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #8
    Open Source?? Really. I thought Maya was commercial software that one had to pay for. Can I really download a copy of the Maya source code?

    I think what you mean is the Maya has a way for users to write there own scripts and extensions to Maya.
     
  9. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #9
    This is true of C++. Most people barely even skim the surface of templates, which is where C++ really shines. Unfortunately, it's also where compilers do NOT, so if you're stuck with older compilers (Visual Studio 2003, for example), you're really limited in what you can do.

    If you want to see something really trippy, check out Template Metaprogramming. The Wikipedia article just barely describes all that can be done. Boost MPL really messed with my head. Maybe some day, I'll find a use for it.
     
  10. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    Location:
    Brobdingnag
    #10
    http://en.wikipedia.org/wiki/Autodesk_Maya

    "An important feature of Maya is its openness to third-party software, which can strip the software completely of its standard appearance and, using only the kernel, transform it into a highly customized version of the software."

    At the bottom of the article, however, Maya is plainly listed in the "Proprietary" software category.
     
  11. Aikiman thread starter macrumors member

    Aikiman

    Joined:
    Jan 24, 2008
    #11
    From Wiki...

    "Open source describes practices in production and development that promote access to the end product's source materials—typically, their source code."

    this is what I mean. Looks as though we are both right. :)
     
  12. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #12
    But they aren't giving you access to the source materials, so, no.
     

Share This Page