5

I have been discussing a project with a client and they want to use a single language to deploy to as many platforms as possible.

(I am not sure that it's such a good idea, because each platform offers a different user experience and UI metaphor. In some cases, screen sizes vary as well. Also, iPhone is out of the running no matter what language we use. But, I digress...)

The project is going to display an arbitrary block of text each day and will track if the user has "read" it. Some other features on the table are "nags" and the ability to go to another days' text.

I know Flash from the CS3 days, and I think that translates into AIR, but I dont know if AIR can do what we want.

On the other hand, I have (a) little experience with Java or Python, but those seem like good contenders also.

Which language should I use here? Why?

Edit:

This is going to run on desktop platforms too.

Moshe
  • 5,022
  • 2
  • 30
  • 49
  • Just the other day, I was looking through a bunch of trade rags in a colleague's office and noticed an article called [One Language to Bind Them All](http://www.sdtimes.com/content/article.aspx?ArticleID=29164) from the March 1, 2006 edition of SD Times. The [first page of the article](http://www.sdtimes.com/content/SDTimesPDFEdition.aspx?File=SDTimes145.pdf) (PDF, reg. required, p. 27) has a big gold ring on it that says C#. I guess this question will be brought up for as long as code exists. – Ben McCormack Oct 05 '10 at 17:08
  • And in the darkness bind them? – Thomas Eding Apr 14 '14 at 22:53
  • See the answers to this question: [How can I write a set of functions that can be invoked from (almost) any programming language?](http://programmers.stackexchange.com/questions/157536/how-can-i-write-a-set-of-functions-that-can-be-invoked-from-almost-any-program) – Anderson Green Aug 19 '14 at 02:25

12 Answers12

17

These are languages that have a very good deployment factors:

Javascript.

Why? It runs on browser, and most platforms you'd care about have a browser. Though, some lower end mobile phones may have severely stripped browser (or Opera Mini, which supports Javascript only on the proxy-side, and very limited client-side Javascript).

JVM

Java Virtual Machine is ubiquitous in nearly every mobile phone, desktop, or server computer. All other things being equal, perhaps it's the best platform if you want easy portability. Nearly every mobile phone, old and new, supports JVM, the only major exception is iPhone.

Python

Python is very ubiquitous in Linux and Unix world; and the language has a very consistent behavior across different platforms, you almost need no additional work to write a cross-platform program in python. However, most Windows doesn't ship with Python by default, and most mobile phone doesn't support Python. OTOH Jython, compiles Python code to JVM; this combines the consistency and ease of use of Python with the ubiquity of JVM platform.

If you don't need to care about iPhone, then JVM development is the way to go. If you hate Java's language syntax, then Jython is a nicer alternative. If you need the most portability though, Javascript is probably the way to go; however writing anything in Javascript is painful.

Lie Ryan
  • 12,291
  • 1
  • 30
  • 41
  • What's the UI framework that would make Python have "very consistent behavior across platforms?" – Dan Rosenstark Oct 26 '10 at 20:02
  • @Yar: Tkinter (from the standard library) is very consistent across many platforms (and with Ttk (Themed Tk), it is no longer the ugly toolkit it used to be two hundred years ago). All other third party UI toolkits are also reasonably consistent: PyGTK, PyQt, WxPython, many more can be found in http://wiki.python.org/moin/GuiProgramming – Lie Ryan Oct 27 '10 at 09:16
  • Thanks @Lie Ryan: any examples of apps done with any of these? If you said, "show me an example of an SWT app," I'd say Eclipse. Mono and I'd say MonoDev... etc. – Dan Rosenstark Oct 27 '10 at 14:09
  • @Yar: Tkinter: IDLE, http://bytes.com/topic/python/answers/453373-most-prominent-tkinter-applications; PyGTK: http://www.pygtk.org/applications.html; WxPython: http://wiki.wxpython.org/wxPythonPit%20Apps; PyQT: http://www.diotavelli.net/PyQtWiki/SomeExistingApplications – Lie Ryan Oct 28 '10 at 17:25
7

C

You can find a version of gcc for any platform you can dream of, from the tiniest microcontroller to the hugest supercomputer, and if you don't find one you can just build a toolchain of your own.

mouviciel
  • 15,473
  • 1
  • 37
  • 64
  • You suggest to write a Windows, Linux, Android & iPhone application in pure C? – Tim Büthe Oct 14 '10 at 14:58
  • At least it is possible. – mouviciel Oct 14 '10 at 15:07
  • I didn't know C can handle GUI in a cross-platform way. If it can, then it would indeed be a great choice. – Dan Rosenstark Oct 26 '10 at 20:04
  • @Yar,@mouviciel,@Tim Büthe: Yes it can, since C has macro, it's always possible to write portable code for any platform, at the least, you just have a big `#ifdef WIN32 my windows code #endif #ifdef __GNUC__ my GCC codes #endif #ifdef SOME_OBSCURE_OS all obscure's code #endif;` and almost nothing outside the #ifdefs :-) – Lie Ryan Oct 28 '10 at 19:42
  • 1
    it will be a Herculean effort, as all the libraries will be different... –  Apr 28 '11 at 20:10
  • @ThorbjørnRavnAndersen: why not, you can use GTK for example which is a decent enough GUI library that requires almost no macros on the application developers part. You'd be surprised at how little cross-platform code is required for cross-platform C development (I used to do it) even without using any of the cross-platform libraries out there. – gbjbaanb Feb 26 '12 at 13:02
  • 1
    @gbjbaanb. I suggest you try and report back. –  Feb 26 '12 at 18:09
  • @ThorbjørnRavnAndersen: I can;t answer for GTK to be honest, but I've done loads of "server" side cross platform stuff. Its not difficult, we even did a 3-platform system once: Windows, Aix and AS/400! – gbjbaanb Mar 02 '12 at 23:00
  • @gbjbaanb Being server side sidesteps the "all GUI's are different" problem completely. –  Mar 03 '12 at 02:37
6

Free Pascal

Free Pascal (aka FPK Pascal) is an Open Source 32 and 64 bit professional Pascal compiler. It is available for different processors:

  • Intel x86
  • Amd64/x86_64
  • PowerPC
  • PowerPC64
  • Sparc
  • ARM

The following operating systems are currently supported:

  • Linux
  • FreeBSD
  • Haiku
  • Mac OS X/Darwin
  • DOS
  • Win32
  • Win64
  • WinCE
  • OS/2
  • Netware (libc and classic)
  • MorphOS

The discontinued 1.0 version also supports the Motorola 680x0.

Lazarus is an open source cross-platform IDE which provides a Delphi-mimic development experience for Pascal and Object Pascal developers. It is developed for and supported by the Free Pascal compiler. Lazarus is available for Microsoft Windows, several Linux distributions, FreeBSD, as well as Mac OS X.

Lazarus

Jim McKeeth
  • 2,126
  • 15
  • 30
5

With .NET, Mono, GTK#, MonoTouch and Mono for Android you can reach the large majority of platforms with any .NET language and have a native looking UI on each.

  • .NET will get you
    • ASP.NET for the Web
    • Silverlight for the Web on Windows and Mac (Moonlight from Mono gets you on Linux too!)
    • Silverlight for Windows Phone 7
  • Mono with GTK# will get you
    • Mac OSX
    • Linux
    • Others perhaps, but less native looking. I hear some have gotten on the Wii with Mono . . .
  • MonoTouch for the iPhone, iPad, etc.
  • MonoDroid for the Android
  • BlackBerry .NET - first I heard of it, but they say .NET on the BlackBerry, I am assuming with QT.

Can't think of any other major platforms you are missing there. You? Of course this points out frameworks that you can use to target all these platforms. I'll let you choose the language. C#, Oxygene or VB.NET are the most popular on .NET. Oxygene (included in Delphi Prism) has the added benefit of being partially compatible with Delphi native for native Windows development, but if you want to use IronRuby or F# we won't stop you.

Jim McKeeth
  • 2,126
  • 15
  • 30
  • 2
    Didn't know about MonoDroid or BlackBerry .NET. Red Five Labs used to make a [.NET runtime for Symbian](http://developer.symbian.org/wiki/index.php/.NET_Technical_Overview) called Net60, but they went out of business. Also, don't forget the .NET Compact Framework for Windows Mobile devices, the .NET Micro Framework for embedded devices, and XNA for Windows Phone 7, Xbox 360 and Zune. EDIT: Silverlight appears to be [supported on Symbian S60v5](http://www.silverlight.net/getstarted/devices/symbian/) too. – Allon Guralnek Oct 07 '10 at 13:01
  • Ordinarily I would question the use of Mono, due to the fact that its not complete, but this project seems simple enough to put onto any of those platforms. – Morgan Herlocker Apr 28 '11 at 15:55
  • @Prof Plum: Mono is surprisingly complete and in wide spread use. It may not be 100% compatible with the latest .NET, but if you test against the compiler then you will know it works - only use the features that are supported in Mono, which is enough to get were you want to go. – Jim McKeeth Apr 28 '11 at 19:06
  • Don't forget about .NET's embedded profile, which runs on the Atmel-based [Netduino](http://netduino.com/). – greyfade Apr 28 '11 at 19:58
  • +1 MonoTouch appears to be the only crossplatform solution including iPhone today. –  Apr 28 '11 at 20:09
4

You might want to take a look at http://www.phonegap.com/

The application you're detailing sounds very simple, and personally i'm not a fan of layers that sit above the native platform, however this may be perfect for you.

Edit: it seems like the nature of the question has changed somewhat.

dannywartnaby
  • 941
  • 7
  • 9
  • Why not a fan of layers? – Jé Queue Oct 05 '10 at 17:35
  • 1
    @Xepoch Completely missed your question, sorry about that. There are a few reasons tbh, and i'm sure not everyone will agree: When a vendor like Apple or Google push out large updates and new frameworks you're in a position to take advantage *instantly*. It's fair to say that the native platform is the most common; it makes fixing bugs easier, asking questions and *onboarding* new devs to a project. In my experience layers typically compromise the look, feel and experience *in some way*. Also, no guarantees that the company producing said API/layer will do so in future - and so on. – dannywartnaby Oct 07 '10 at 12:31
3

ActionScript 3 is the language. It runs on wide variety of platforms. In browser (flash player), on desktop (AIR), on mobile devices in browsers (Android) and also as native applications (Android and iOS both). Forget about flashlite.

scriptocalypse
  • 272
  • 1
  • 7
  • Can Flash interact with databases? – Moshe Oct 06 '10 at 13:35
  • Of course. You just need to use the flex framework which makes life more easier. That's all. –  Oct 07 '10 at 03:32
  • Jase21 - can you provide some references for using flex and flash in tandem to work on database stuff? Also, will the db stuff work on iOS? – Moshe Oct 10 '10 at 20:40
  • Adobe is planning to release a server-side version of actionscipt. With that you can program both the client-side and server-side using actionscript. You can cross compile programs written in actionscript to native iOS application. If you are too hesitant to use actionscript then you can use open-web technology like javascript on (on client side as well as on the server side using node.js). –  Oct 14 '10 at 03:52
  • Using Adobe AIR you can use SQLite also. –  Oct 14 '10 at 03:53
  • A library to connect to mysql. See this: http://www.jonnymac.com/blog/2007/05/08/actionscript-3-mysql-drivers-assql-and-asql/ –  Oct 14 '10 at 04:05
  • One more: http://blogs.adobe.com/cantrell/archives/2010/04/one_application_five_screens.html –  Oct 14 '10 at 04:09
  • I see Actionscript, as annoying as it can be (due to multiple *proprietary* workflows, which often have contradicting metaphors), is still the only one that can be compiled for all platforms. (Windows, Mac, Linux, Android and iOS.) – Moshe Nov 15 '10 at 17:30
  • Proprietary in the sense that the player is controlled by Adobe, so that there isn't different variations and fragmentation. Fragmentation is very difficult to handle. Also, the devices like Nokia N900 running Maemo, and the upcoming MeeGo (by Intel & Nokia) also include flash capabilities. Its the next best thing other than native code. –  Nov 16 '10 at 03:35
  • @jase21: Just like Adobe has been planning on releasing a *working* mobile version of Flash? AS3 == EMCAScript == JavaScript. – Josh K Apr 28 '11 at 19:15
  • @Josh K there's already a working mobile version of Flash on Android phone browsers, and the AIR packager works perfectly well on iOS and Android to create native applications. And to say that AS3 == JavaScript is a gross mischaracterization. AS3 is more akin to ECMA4, which was quite different from the JS you're accustomed to either from ECMA3.X or from ECMA5. – scriptocalypse Apr 28 '11 at 21:09
  • @Scriptocalypse: I haven't seen a *working* version of mobile Flash on *any* Android device. Frequently crashing, failing to load pages, huge stall / wait times. You can't honestly say that is *working*. – Josh K Apr 28 '11 at 21:26
  • @Josh K Are we just going to shoot anecdotes back and forth? I can say that I have seen it working. Much of what you're talking about is a result of content created to run well on machines with 8x the horsepower of current gen phones, and with 5-10MB of assets to download. Comparing like-with-like tasks, JS often performs with equal or worse results in my own tests... and none of this takes native apps into account which don't suffer the download tax every time you open them. – scriptocalypse Apr 28 '11 at 21:37
2

uhm, how about haXe? You can target a lot of platforms by now and should you learn OCaml you're free to write a new backend for whatever you fancy.

back2dos
  • 29,980
  • 3
  • 73
  • 114
2

I recently read how Netflix deploys to over 400 platforms using HTML5. It is definitely worth a read.

In general, I wouldn't try to commit to one language. At the company I work at we utilize various languages and technologies. It is about using the right language for the right job just like you use the right tool for the job. I wouldn't use a screw driver to hammer a nail just as I wouldn't use a hammer to change my car's lug nuts.

durron597
  • 7,590
  • 9
  • 37
  • 67
Jim
  • 121
  • 2
2

It sounds like this is for mobile platforms correct? In that case you're pretty much out of luck as there's no language to rule them all. There are products that will cross-compile a solution to another (such as http://www.xmlvm.org/android/) but apart from that you'll have to use the native language/environment.

Martijn Verburg
  • 22,006
  • 1
  • 49
  • 81
1

With C# .NET you can deploy to any major mobile platform natively (big difference from HTML 5 platforms like PhoneGap which are basically hybrid web apps) utilizing Mono (for Android), MonoTouch (for Apple), and BlackBerry.NET.

The language and platform is well supported by MicroSoft with many employers looking for that skill set. If your not completely sold, just go to your favorite tech job website and start plugging in different languages/platforms in the search box. You will get an idea of which direction you want to take.

Jer
  • 11
  • 1
1

LiveCode / Runtime Revolution

deploys on Mac, Windows and Linux and makes standalone software for all sorts of other platforms as well.

0

Adobe Flash/Flex

(not sure if that was being ruled out in your question)

Runs in nearly all browsers, most mobile platforms and with AIR, most desktop platforms.

Read: http://business2press.com/2010/09/11/adobe-reversi-allows-developers-to-make-single-app-for-different-platforms/

Watch: http://www.youtube.com/watch?v=22vicDlzmkI&feature=player_embedded

Adam
  • 2,141
  • 2
  • 16
  • 15