Which language is best for a cross platform program?

Discussion in 'Mac Programming' started by AzMacNoob, May 25, 2007.

  1. AzMacNoob macrumors newbie

    May 25, 2007
    Phx, AZ
    Hiya guys!

    First of all, I would like to introduce myself breifly in my introductory post in the macrumors community. I am the AzMacNoob looking for advice on several things and come here in hopes of finding the most skilled of programmers :)

    I am trying to get an idea of which direction to go with a project in mind. Among the first steps is choosing a language that could accomplish my goals. I would like the program to be used on Windows XP/Vista, MacOS X and even on the various Palm OS's that exist (blackberry, PalmOS, WindowsPalm). I want to cut out alot of the work that used to be required back in the day when you had to reprogram the same thing to work with each OS. I have a feeling that C# may be the best way to go but I am not totally sure and am seeking some sound advice from the :apple: users who really know their stuff.

    Thanks bunches in advance for your response and I am looking forward to any great ideas or suggestions on which language to choose for the project.

  2. Nutter macrumors 6502

    Mar 31, 2005
    London, England
    If you want to cut out the hard work of developing for multiple platforms, Java is (still) the only option.

    Otherwise, I suppose the most common language for cross-platform development is C++. On the Mac, this will let you use Cocoa due to the magic of Objective-C++, a superset of C++ that implements the same object-oriented features as Objective-C.
  3. janey macrumors 603


    Dec 20, 2002
    sunny los angeles
    Even with Java, you're gonna have a hard time supporting all of those platforms. Is there some reason the project has to run on all of them?
  4. mags631 Guest

    Mar 6, 2007
    Which Parts?

    I'm guessing you do not need a cross-platform user interface given that you intend to support Palm? In that case you are probably looking at writing some core libraries in a cross-platform approach (this can be C, C++) and developing custom user interfaces for each platform (which can be in whatever tool you choose on each platform). That's how I would do it.

    Java is pretty much your only option if you want everything to be in one language and to share many commonalities... however, you will still need to write code that is specific to each platform.

    Though if you were to describe your project in more detail and I might change my answer...
  5. Flynnstone macrumors 65816


    Feb 25, 2003
    Cold beer land
    I was going to say RealBasic until you said Palm ...
    What about Flash?

    [edit] I just noticed I'm a "6502". Scary, I think I have one at home
  6. iSee macrumors 68040


    Oct 25, 2004
    There isn't a general good answer to your question. Other posts have laid out good options, so let me ask you some questions so we can point you to the most appropriate one (they all have pluses and minuses, strengths and weaknesses):
    What type of project is it? A game? A utility? A productivity app? A social app?
    Is your project UI heavy?
    Is there Internet connectivity involved or is it local only?
    Does it need to be able to crunch numbers or process a lot of data?
    Can you prioritize platform support?
    How much software development experience do you have?
  7. AzMacNoob thread starter macrumors newbie

    May 25, 2007
    Phx, AZ
    First of all, thank you all for your swift responses. This definitely has me thinking about more options than just what was suggested originally, C#.

    So far the responses are C, C++, Java and possibly REALBasic if Palm support was not included. Java appears to be the front runner if we are trying to cut out alot of the rewriting and use the same thing on each platform. C++ or C if the base of the program is made individual interfaces are made for each platform.

    Well, a little more about the project. It is going to be a pretty simple software program which will be like a text editor with the main purpose of taking notes. There will be several additions that will make it above the average text editor and note taker but what those features are will be what actually makes the software worthwhile.

    We have a 9 yr programmer who said, "wtf, you want it to work on a Mac?" He instantly started to look for a way out because he has told us he has never had to make anything work on a Mac before, much less a Palm and so the development team is like a fish out of water. The new boss is a Mac lover and won't stand for this software not working on a Mac and the Palm functionality is a must.

    Productivity, as pointed out above it will be like a text editor.

    Customizable backgrounds to go with the notes and drawing boxes are about as heavy as the interface will get other than a full assortment of functionality buttons/tool boxes.

    Local only. Ability to share notes through Palm to desktop.

    Yes, but not numbers. If you think about a dictionary/thesaurus. If you type in a keyword and hit a special key combo or something the word should enter into the text document along with the definition. So, it'll be like a command used by words to call from a database.

    The company has always been a Window's based company but the new boss is a HUGE Mac lover and so the Windows XP knowledge is there but anything with Palm and Mac just puts a puzzled look on all our faces.

    I am mostly the peon, 2 yrs experience and so I get to do the dirty work of just trying to figure out which direction to go and then report it to the 'uber' guys.
  8. whooleytoo macrumors 604


    Aug 2, 2002
    Cork, Ireland.
    Actually, if it is such a simple project, it wouldn't surprise me in the slightest if the easiest & quickest way to do implement it on each platform using the language/IDE of choice on each. (e.g. Xcode/Cocoa on OSX, C# on Windows? etc..)

    An experienced Cocoa developer could build a reasonably full-featured text-editor/note taker in a day; with minimal coding. I'm assuming the same is true on the other platforms.

    You could probably spend a lot more time writing a single piece of software for all platforms, but taking into consideration the UI/storage limitations of the Palm devices; and getting it to appear with a reasonable UI on the Mac & PC.

    The obvious downside would be you'd have 3 different codebases to maintain; but I reckon that pain would be worth the gain of 3 quality pieces of software vs. 1 cross-platform application.
  9. mags631 Guest

    Mar 6, 2007
    I don't know if I would go that far... but I think your general point is valid: be careful trying to design one code base that does all things (the cost and complexity of cross-platform applications can be significant) -- make wise decisions about what will be cross-platform and what will be plaform-specific. I strongly recommend platform-specific code for the UI (not saying the design has to be different, just the code).
  10. iSee macrumors 68040


    Oct 25, 2004
    A programmer who wants out at the prospect of new technology??? Not an uber-guy.

    Anyway, at my last job I developed Mac/Win software. I also did a PlamOS client for one title.

    I'd consider doing it like this:

    * Use one of the cross-platform application frameworks to develop a cross-platform Mac/Windows app. Contenders are:
    - Java
    - Qt (C++) costs some $ for a commercial product, but it a lot cheaper than developing your own cross-platform application framework! This is supposed to be the best, most complete cross-platform framework around.
    - wxWidgets (C++) I think this has no licensing fees for commercial software. I've used it a little but not for anything significant.
    - realBasic
    - ?

    Just make sure the apps work and look reasonably like a native app. One of your biggest pitfalls could be getting your Windows-centric developers to make the Mac app work mostly like a Mac app. Somehow you've got to get them to read the human interface guidelines for Mac OS development and a few other Mac development guides.

    I separate out the desktop client from the mobile client because usually the UI design and program architecture need to be substantially different between the two types of platforms.

    For the Palm client you need a Palm OS client and a Windows Mobile client, right? When I did Palm OS development the only real choice was C (maybe C++ if you were careful) addressing the Palm OS api (well there were other options for certain apps, but nothing general purpose.) Now however, the hardward is much more powerful, so you your type of app Java is a real possibility. I think people use "SuperWaba," which is available for Windows Mobile as well. Just be sure to talk to real developers that have used it successfully before you commit to using it. When I did my Palm OS development there were a lot of articles touting this or that Java VM, but had I tried to use Java the project would have failed (some of the Java VMs were never finished, one was too expensive to even consider, and all of them were far, far too slow and resource hungry.)

    For your Windows mobile client you're probably looking at one of the native apis (.NET compact framework probably) or Java (Superwaba, again, I think, is a good one).


    I guess you could:

    Do Java all around (though I'd still have two main code bases for desktop and mobile) with some shared items.

    Or do a C++ framework for the desktop apps and Java for the mobile platforms.

    Or if Java won't cut it on the mobile side (because of speed issues, memory hogging, or inability to act native enough), go native for both mobile platforms and write two mobile clients.

    Or, if you actually drop the Mac platform and Palm OS mobile platform, you can use C# for the Windows and Mobile Windows platforms.
  11. kainjow Moderator emeritus


    Jun 15, 2000
    If you want a successful Mac application, write as much as you can in C++ and make the Mac UI in Cocoa. Or else it will have a pretty crappy interface, unless your Microsoft or Adobe (the very few remaining companies that still make decent user interfaces in Carbon). If your app isn't a niche app, it needs a good UI to be successful.
  12. AzMacNoob thread starter macrumors newbie

    May 25, 2007
    Phx, AZ
    Thank you for your input, especially your post iSee. It really goes into the next question I was going to ask.

    The new boss is looking to changing her strategy. She wants to just make a branch or 2nd company for the new Mac/palm/Windows compatibility software because the development team has 17 years together working on windows only apps and changing their minds or all of the developers is gonna be too long of a process.

    Anyway, if she does I may be a slight promotion in the new company which will focus on the new project and be more platform friendly to all new software coming out of it.

    She has had several Mac's priced out and a couple of PC's new desks and a inside joke, 'Hot secretary.' Yes yes, she wants to hire a hot secretary for me (even tho she doesn't really mean it) She wants to know what software packages she has to get to be able to program successfully in a way where the software is cross platform friendly, easily update/upgradeable and can give the incoming developers an edge or an easier job with stronger or easier to use software.

    That was gonna be my next question but looks like it was already kind of explained in iSee's post. What are the names of the software I'd use on Mac to develop Mac/Palm software or use on PC to develop Windows XP/Vista and express.

    We have always used the standard Visual Studio for all productions because it was all PC only software coming out.
  13. janey macrumors 603


    Dec 20, 2002
    sunny los angeles
    what's wrong with keeping visual studio for windows xp/vista/mobile ? ;)

    And using xcode on macosx is most logical if you're gonna go with the native route instead of java etc., in which case you might want eclipse or intellij (out of many IDEs out there...).

    As for Palm, I gave up on a project for palmos a while back because it was frustrating (to me, okay? :eek: ), but a not-shabby place to start is http://www.palm.com/us/developers/


    Argh, my post was a bit premature. I shouldn't really be tossing out anything until you say just a tad bit more on how exactly you're doing this, AzMacNoob...like which language and what platforms...
  14. cube macrumors G5

    May 10, 2004
    Swing has pluggable look and feels.
    You can improve the Windows look and feel with JGoodies.
    You can improve the Mac look and feel with Quaqua, and integration with MRJ Adapter.
    Java opens the door to billions of cell phones.

    Java all the way. All that C-based stuff is the past.
  15. janey macrumors 603


    Dec 20, 2002
    sunny los angeles
    on a sidenote...
    i don't really care what swing has or why java is so great, but i really *&#$ing hate that there's no way to get translucent non-rectangular windows easily without major hacking with/without JNI. (everyone telling me to use that cheap screenshot hack, DIE A MISERABLE DEATH.)

    Maybe I'm just bitter over spending massive amounts of time dealing with that particular issue in one project, but ARGH!!!

    However, since then, there have been a fair number of excellent tutorials (like this one) and tools for dealing with this particular limitation. Which sorta makes me madder.
  16. cube macrumors G5

    May 10, 2004
    Note that while Java is a good language and supports easier cross-development for a lot of platforms, it is not my favorite one, so this is not coming from a Java fanatic.
  17. janey macrumors 603


    Dec 20, 2002
    sunny los angeles
    sure had me fooled :D

    java's not entirely my favorite, but it's most appropriate to the original topic, so why worry?
  18. AzMacNoob thread starter macrumors newbie

    May 25, 2007
    Phx, AZ
    You've all been a great help, I now have an idea of what we may look into. Looks like we are going to have to do multiple languages instead of the one single language.

    Thank you also for the great resources that you linked. I'm very glad OS X has standard guidelines for development and Palm offers help to those who develop for their platform.

    Now with this little bit if help we will be going into more specifics of the project but are now going to focus on the ordering of Mac hardware /drool. I am also a long time PC user and haven't really used a Mac since OS 9.2.1. I am looking forward to the MacPro and have posted a thread here , in the buying tips/advice forum about my new MacPro shopping situation.

    Now after the buying, it's a matter of finding mac developers.
  19. Edot macrumors 6502

    Jan 29, 2002
    Even with all of the nice features of Java, it still includes lots of overhead. When writing programs for embedded devices, C and C++ win out because of speed and resource requirements.
  20. Soulstorm macrumors 68000


    Feb 1, 2005
    C++, hands down. Easy to learn, extremely difficult to master, with wide-range support on all platforms, and most of APIs like OpenGL.
  21. cube macrumors G5

    May 10, 2004
    For many phones, Java is your only option.

    If you stick to J2ME, you don't have to develop multiple versions of the program.

    And even for developing only one version, Java means less annoying problems, so cheaper.
  22. iSee macrumors 68040


    Oct 25, 2004
    I'm not quite sure which languages you are leaning toward, but:
    For C/C++, etc., Visual Studio 2005 is the best development tool and, in my opinion, a very good IDE.

    For Mac C/C++/objective-C Xcode is the standard development tool.

    For Palm OS development in C/C++ CodeWarrior is the choice.

    For Java development I'll have to defer to others who've done full scale projects (I've done various small things like proof-of-concent projects, but nothing big enough that it really mattered what IDE I was using).

    Good luck your project! When you are hiring your Mac developers get at least one or two with experience developing cross-platform apps. That shouldn't be that hard--a lot of them do.

    Also another tip: The C/C++ Palm OS development environment borrows a lot of things from the pre-OS X Mac development environment. A developer who has experience with C/C++ Mac OS 9, 8 development will catch on to Palm OS development quickly. The tools are the same (CodeWarrior), the way you deal with resources is similar, the way you structure your event loop is the same, and many other things. Even if you go the Java route on the Palm OS client, you will get involved in system level things at some point. (The Palm OS app I worked on was pretty large for a Palm app, but still wasn't large enough to require a separate dedicated specialized programmer. So my point is, if your Palm OS client works out the same way, put a programmer with classic Mac OS experience on it.)
  23. aleister55 macrumors newbie

    May 28, 2007
  24. lorductape macrumors 6502


    Jun 23, 2006
    t3h usa
    i'd say if you're doing standard apps as opposed to web apps, i like c++. it's easy to switch between platforms if you utilize libraries that compilers on both OS's have, and then i'll just stick the code into the different compiler and fix the few runtime errors and i'm good to go for both platforms.

    that being said, the ultimate one is java (web related, of course)
  25. Nermal Moderator


    Staff Member

    Dec 7, 2002
    New Zealand
    I'm just going to throw a spanner in the works and mention that I like .Net :)

    I'll freely admit straight away that I haven't tried moving any "real" apps across to Mono/Cocoa# ("Mac .Net", if you will), but it seemed to work well enough with the dummy apps I tried. On the other hand, if you don't know any .Net already, then you'd probably do better to use another language.

Share This Page