Monday, July 27, 2009

What is the best language to program on for both pc and mac?

I'm considering writing an application for both the PC and a MAC, most people I've spoken to have said, each one needs to be programmed seperately, but that seems very time consuming. I understand there are toolkits that can be used for both. For example how is something like a polished app Firefox written for both? What are the standard tools used for application development. On a PC I know its Visual C++, VB.NET (or .NET framework) on a Mac I hear its objective C , is there a better way to just write one codebase?

What is the best language to program on for both pc and mac?
Maybe you should try Java
Reply:It depends on the type of program you are planning on writing. If you are doing something low-level, like lots of graphics, communicating over serial or USB ports, then a language like C or C++ would probably be best.


If it's high level, like web based apps, then Java is your best bet.





With C or C++, you can minimize the labor involved in writing for multiple platforms by isolating the machine or operating system dependent code from the main body of your code. Then, rather than writing two programs, you just #include the modules specific to the platform.





Things are getting easier now that Mac uses Intel, but there are differences still.





The basic rule is that as long as you use ANSII C, it will compile on any compiler. If you're doing a simple console app, then with C, following the rules, not using any machine or OS dependent code, it will compile on any platform with a C complier including Sun, DEC, Linux, PC, Mac, QNX or any other. So, it just depends on what you want to do.
Reply:Take a look at http://www.mono-project.com/Main_Page





From the site, Mono provides the necessary software to develop and run .NET client and server applications.





I do not know much about it, but its something to look at.





Also, what about Flash? Based on your criteria, I think Flash is right up your alley.
Reply:I don't know if it will match your requirements, but have you looked at JAVA? That language is meant to be portable. Check out Sun Microsystem's web site.





Knowing C/C++ would not be enough to port programs between the MAC and PC because both the MAC and PC use completely different function calls. The programs are compiled differently too.





Keep in mind that trying to create portable (almost) code in C++ or some other language leads to multiple copies of bloated, slow code.


Most, if not all Linux ported programs to Windows aren't nearly as efficient as a program with the same program design that was programmed and optimized for Windows.
Reply:Java. Both Macs and PCs has their own compiler to compile the same bytecode generated by Java. Though, I don't know if the same programs in Macs and PCs can talk to each other. It has been a while since I have done any coding.








XR
Reply:You could write a program in a language like c++ and just compile it with a Windows compiler on the PC and an Apple compiler on the MAC


No comments:

Post a Comment