Slashdot Mirror


Multi-Platform App Created Using Single Code Base

andylim writes in with news of a reasonably impressive demonstration of the multi-platform capabilities of Adobe AIR. "Christian Cantrell, a technical product manager at Adobe, has created an app for multiple platforms including OS X, Windows 7, Ubuntu, Android, iPhone OS, and iPad OS. What's amazing is that all the platforms use the same code base. 'The application is called iReverse, and it's a fully functional Reversi game (complete with a pretty decent AI). Although iReverse is fun to play, the most amazing thing about the project is the fact that it runs in all these different environments completely unchanged. In other words, the exact same code base is used to build versions for five different environments. There's no other platform in the world that can boast this level of flexibility — not even close.'" Cantrell says he will open-source the code for iReverse and document how he pulled this off.

34 of 296 comments (clear)

  1. Probably 500 lines of actual game play code by DarthBart · · Score: 5, Funny

    combined with 350 million lines of #ifdef _LINUX_ or #ifdef _MACOS_ or #ifdef _UNICOS_.

    1. Re:Probably 500 lines of actual game play code by Jurily · · Score: 2, Interesting

      No, they said it's completely unchanged across platforms. Wanna guess how it looks on Windows?

      In other words, the exact same code base is used to build versions for five different environments. There's no other platform in the world that can boast this level of flexibility -- not even close.

      These guys obviously never heard of Unix before.

    2. Re:Probably 500 lines of actual game play code by ciroknight · · Score: 3, Interesting

      Sure it's completely "unchanged" on every platform. That doesn't mean that it doesn't have a million lines of ifdef'd code. It's just the code doesn't do anything on the platforms where it's not needed. There are vast number of portable libraries and a somewhat smaller number of applications that do just this, having platform specific code conditionally compiled in.

      Anyways, I fully suspect this guy's "solution" will be something like "We just used Flash and embedded it into these application 'runtime' thingablobs and then it was simply a matter of loading up the platform agnostic swf file." "Wait, what about the source code?" "Here's the source to the Reversi game. ahahaha did you seriously think we'd open source a runtime that'd put half of us out of a job???"

      --
      "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    3. Re:Probably 500 lines of actual game play code by ciroknight · · Score: 3, Insightful

      ...And the runtime environment has millions of lines of #ifdef __LINUX__, ...

      Whether you hide behind a runtime is entirely irrelevant. Because the APIs differ between OSes, somewhere, someone had to write some nasty sticky portability shims.

      --
      "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    4. Re:Probably 500 lines of actual game play code by techno-vampire · · Score: 2, Informative
      These guys obviously never heard of Unix before.

      They also don't know anything about the history of computing. COBOL was doing exactly that back at the end of 1960, which is one of the big reasons it became popular.

      --
      Good, inexpensive web hosting
    5. Re:Probably 500 lines of actual game play code by skids · · Score: 2, Interesting

      You can indeed support platform-specific features in an abstracted UI. You just have to abstract the features, and demand that developers check for them, turn them on, and provide alternative behaviors when they are not available. I know, why bother, that's the same as #ifdeffing around with OS APIs... well, it can work out when a subset of OSes have the same features. The application only has to deal with the features it wants (and their absense) and not each OS which has that feature.

      There are a lot of good attempts at reusable portability libraries, but few projects use them and instead opt to re-invent the wheel. It's a shame, actually, many of them are not very onerous and are a great place for code sharing to reach a wide user base.

  2. Not even close? See: Java. by fahrbot-bot · · Score: 5, Insightful

    What's amazing is that all the platforms use the same code base. ... There's no other platform in the world that can boast this level of flexibility -- not even close.

    Guy creates functionality I've been using in Java for 8 years; film at 11.

    --
    It must have been something you assimilated. . . .
    1. Re:Not even close? See: Java. by Foofoobar · · Score: 4, Insightful

      Well speaking as a Java fan myself, that's not entirely true. This runs on the iPhone which Apple won't allow Java code to run on. Apple would like to see Java die and is doing it's best to kill it and Microsoft as well. The only people who like it are enterprises and developers... thankfully though, that's still alot of us and eventually Steve Job's will die.

      --
      This is my sig. There are many like it but this one is mine.
    2. Re:Not even close? See: Java. by IsaacD · · Score: 2, Funny

      ...eventually Steve Job's will die.

      deities don't die.

    3. Re:Not even close? See: Java. by dominious · · Score: 3, Insightful

      This runs on the iPhone which Apple won't allow Java code to run on.

      So Java is not flexible because Apple won't allow it on their platform? wtf?

      ... There's no other platform in the world (JAVA) that can boast this level of flexibility (JAVA) -- not even close. (JAVA)

      some /.ers correctly classified this as slashvertisment

    4. Re:Not even close? See: Java. by StormReaver · · Score: 4, Insightful

      This runs on the iPhone which Apple won't allow Java code to run on.

      That's a technicality. The only thing holding Java back from running on the iPhone is Apple's corporate politics. Technologically, Java is capable. As such, I'd give the point to Java.

      Qt is another multi-platform technology that predates (and, like Java, betters) what is being described in this article. Contrary to the article, Java and Qt are much better for cross-platform development, and predate this attempt by more than a decade. This article is way late to the party.

    5. Re:Not even close? See: Java. by MacDork · · Score: 2, Interesting

      Apple would like to see Java die and is doing it's best to kill it

      All of their major online properties run on Java. iTMS, Apple store, Mobile Me ... Seems like odd behavior if the company wants to 'see Java die.' Besides, how else are they going to sell 11 million songs a day? Rails? PHP? .Net?

  3. Same codebase... by Zapotek · · Score: 5, Informative

    holding different platform specific implementations: http://blogs.adobe.com/cantrell/images/ireverse/FB_projects.jpg
    That's doesn't seem all that impressive...

  4. Marketing by g051051 · · Score: 4, Insightful

    It's not "one codebase for 5 environments", it's "one codebase for the AIR app, and multiple codebases for AIR itself that had to be ported to 5 different environments." There's nothing even remotely special about that, just empty hype.

    1. Re:Marketing by g051051 · · Score: 2, Insightful

      The point is that it isn't unique or special, it's just another VM architecture, just like Java, .NET, etc.

  5. Only half the battle... by Manip · · Score: 2, Interesting

    While interesting it has been done before and to be honest these "portable platforms" all suffer from the same flaw: the applications they produce aren't native to ANY platform. What I mean is that while they run fine in terms of functionality they all look ugly compared to the environment and don't support typical OS features like hotkeys.

    Look at GTK+. The applications work fine on Windows and OS X but you can tell within a second that they aren't native applications, they're badly ported Linux applications.

  6. iReverse by AndGodSed · · Score: 3, Funny

    Wonder how long it will take Apple to sue because he dared use i as the first letter of his program name...

  7. Re:all those platforms are yours... by binarylarry · · Score: 4, Insightful

    The current Java runtime makes Flash/AIR/.NET/Whatever look like a retarded snail trying to climb a salt hill. It's much faster than the competition, it even competes with statically compiled native code in terms of execution times. You rarely even use Java's interepter, the runtime compiles bytecode on the fly to native code and executes that.

    Swing has traditionally sucked, which is why SWT was created.

    Now tools for things like this are where Flash beats Java. Java really only has tools for programmers, not psuedo-programmer artist types who typically create cool things in Flash. Sun seems to have never gotten this aspect.

    --
    Mod me down, my New Earth Global Warmingist friends!
  8. Flash and HTML5 make Java look efficient. by Anonymous Coward · · Score: 3, Insightful

    When the industry as a whole moved from C and C++ to Java in the late 1990s, one of our main problems was the bloat that Java brought to the table. Memory consumption was a real issue, as was its slow nature. Things have improved somewhat, mainly driven by vast hardware advances. 15 years on, Java is finally usable.

    Now, when we moved from C and C++ to Java, we did get a huge productivity boost, even if our apps themselves were more bloated and ran slower. Apps that would've taken us a year to develop using C++ could be finished in a couple of months using Java. We could also develop much more complex software than we could using C++. So Java did offer some real benefits, and that's why it became popular.

    We can't say the same for Flash and HTML5, however. They both suffer from far worse bloat than Java ever did. For instance, take watching videos on YouTube. I just did that using Firefox on Linux, and the Firefox process is now using 3966 MB of RAM. That's its resident usage, not virtual usage, as well. Its virtual usage is currently 4512 MB.

    HTML5 isn't much better than Flash. I've tried some demos that cause similar memory usage problems, even in Chrome. And they run so fucking slowly, too.

    So not only do Flash and HTML5 it offer a worse runtime experience for the user, but they're much more limited than Java, and much slower to develop with. They're failures all around. Unfortunately, a lot of former PHP developers from the 1990s and early 2000s (ie. idiots) have now become managers, and somehow think that web-based technologies are beneficial for users and developers. Clearly, they're not. They make everyone's lives more miserable.

    1. Re:Flash and HTML5 make Java look efficient. by Jahava · · Score: 5, Informative

      When the industry as a whole moved from C and C++ to Java in the late 1990s, one of our main problems was the bloat that Java brought to the table. Memory consumption was a real issue, as was its slow nature. Things have improved somewhat, mainly driven by vast hardware advances.

      Interesting take - unfortunately incorrect. Java's performance issues were almost entirely due to the interpreted nature of its code. When it was originally released, all Java code was interpreted by the JVM. The result is similar to running code through an emulator ... often usable, but certainly not competitive with native applications. The introduction of Just-in-time compilation to Java (via HotSpot and similar runtime engines) made all the difference in the world. By Java 1.2 (1998), the JRE came equipped with HotSpot and basic performance became an (often inappropriately cited) non-issue. Hardware advances played as much a role in speeding up Java as it did any other language.

      Now, when we moved from C and C++ to Java, we did get a huge productivity boost, even if our apps themselves were more bloated and ran slower. Apps that would've taken us a year to develop using C++ could be finished in a couple of months using Java. We could also develop much more complex software than we could using C++. So Java did offer some real benefits, and that's why it became popular.

      More info can be found with Google.

      Most of the benefits offered by Java are those bestowed upon an application by virtue of running in the Java Runtime Environment (JRE), including automatic memory management (garbage collection), strong exception handling, cross-platform portability, sandboxed code execution, security controls, dynamic class generation, to name a few. Java's syntax is also familiar and effective, and caters to many newer programming models and paradigms. Nothing about Java allows applications to be more complex than they were before... I dare you to find something as complex as the Linux Kernel, or something whose complexity is handled better in Java than via a C++ toolkit like QT. Java's advantages have always been related to its abilities to simplify coding challenges, allowing more effective, secure, and functional code to be produced faster (and with a lower learning curve).

      We can't say the same for Flash and HTML5, however. They both suffer from far worse bloat than Java ever did. For instance, take watching videos on YouTube. I just did that using Firefox on Linux, and the Firefox process is now using 3966 MB of RAM. That's its resident usage, not virtual usage, as well. Its virtual usage is currently 4512 MB.

      This is certainly a bit subjective. For example, my Firefox running on Linux watching YouTube is only using 80MB of memory, with Flash's "npviewer.bin" adding another 10MB. However, RAM usage is not a bad thing. Traditionally, when RAM came in far smaller quantities than it did now, developers frequently traded extra CPU cycles and disk I/O to conserve memory. Now, it's almost the opposite. A good application, especially a foreground application like a web browser, will use RAM liberally to conserve bottleneck resources like CPU, bandwidth, and I/O. Most of the time, the application profiles the environment that it is running in and chooses how much RAM it will use for optimization based on that profile. A system with 1GB of RAM will likely have big applications like Firefox use significantly less memory than one with 8

    2. Re:Flash and HTML5 make Java look efficient. by moonbender · · Score: 2, Informative

      The GP didn't defend wasting memory, he said that on devices that do have ample memory, it's only smart to use it. Hard to find a fault with that.

      For instance the String class represents all strings using UCS2 internally - if that isn't bloat I don't know what is!

      Seems a fairly widespread practice: "UTF-16 is the native internal representation of text in the Microsoft Windows 2000/XP/2003/Vista/CE; Qualcomm BREW operating systems; the Java and .NET bytecode environments; Mac OS X's Cocoa and Core Foundation frameworks; and the Qt cross-platform graphical widget toolkit." (Wikipedia with citation needed, so beware.) I guess for C programs the "internal representation" is just relevant for interacting with the OS API?

      Why are programs like Chrome written in C++ anyway? It's because everyone knows you can't make responsive apps in Java, and the reason you can't has nothing to do with fancy runtime compiler optimizations and everything to do with inability to carefully control working set size.

      Not saying you're wrong, but for what it's worth that's not a very good example. Chrome is C++ because WebKit is. WebKit is C++ because KDE is. Java's responsiveness has nothing to do with why KDE is C++.

      --
      Switch back to Slashdot's D1 system.
    3. Re:Flash and HTML5 make Java look efficient. by 0xdeadbeef · · Score: 2, Insightful

      > For instance the String class represents all strings using UCS2 internally - if that isn't bloat I don't know what is!

      Because if 7-bit ASCII is good enough for America, it ought to be good enough for everybody!

    4. Re:Flash and HTML5 make Java look efficient. by ckaminski · · Score: 2, Insightful

      The biggest failure of Java was the whole "applet" integration mess with the browser. Slow to download, mixed-bag JREs that were usually mutually exclusive (Java evolved fast back then). and 80% of the time the applet just didn't load or start.

      Left the whole industry with a sour taste in it's mouth. Could be why I've heard HTML5 is dropping applet support.

  9. Two points by Blakey+Rat · · Score: 4, Interesting

    First of all, Air is broken for GUI apps (on Windows and OS X at least.) It gets many, many basic details of how widgets are supposed to work completely wrong. And, shock and amazement, most of the wrongness is the exact same wrongness that Flash widgets have-- gee! You'd almost think it's just a crummy Flash runtime!

    Secondly, RealBasic can target three platforms from a single codebase (Mac, Linux, Windows) and gets two of them completely right. (Linux may be right, but I don't know enough about it to really verify it.) So this is nothing new-- that capability has been in RealBasic for at least 4 years now.

    I love these breathless excited summaries. The only real point to take from this is Christian Cantrell is completely ignorant of Flash's competitors in this space. (And kdawson loves hype, the hype-ier the better.)

  10. Bollocks by SpinyNorman · · Score: 2, Informative

    There's no other platform in the world that can boast this level of flexibility -- not even close

    Qt will let you run a single code base on OS/X, Windows 7/etc, Linux and any platform that Qt/Embedded has been ported to. Not just trivial apps like Reversi, but also ones using multithreading, networking, etc. There's also a fair degree of cross-platform multimedia support too, although that's a work in progress. Personally I choose to use PortAudio for cross-platform audio aupport together with Qt.

  11. Re:all those platforms are yours... by forkazoo · · Score: 2, Interesting

    Java? It's really sluggish and non-elegant compared to AIR. I'm still not sure how the Java interpreter performs so badly on UI elements. While technically probably OK (it's been losing to .NET though), the mere fact that all Java apps feel sluggish creates a bad image for Java. That combined with the fact that .NET has been constantly instructing new features and tens of languages support it (C#, Basic, Object Pascal, ASP..)

    Java does bad on GUI's. It's true. OTOH, it doesn't actually do that badly on graphics. It has OpenGL bindings, so for things like making games, it actually does just fine. I'm not personally a big fan of Java, but normal "businessy" GUI apps are really the only are where Java really falls down on performance. And, even then, it's nowhere near as bad as the Java reputation would suggest.

  12. Re:all those platforms are yours... by KingMotley · · Score: 2, Insightful

    Off topic, but I couldn't help but read your sig. Apparently you and/or the person that wrote that list never spent more than 2 minutes in .NET because the majority of the reasons given are just plain false, and another large portion are poorly hidden marketing gimmicks.

  13. Re:all those platforms are yours... by centuren · · Score: 5, Insightful

    Java? It's really sluggish and non-elegant compared to AIR. I'm still not sure how the Java interpreter performs so badly on UI elements. While technically probably OK (it's been losing to .NET though), the mere fact that all Java apps feel sluggish creates a bad image for Java. That combined with the fact that .NET has been constantly instructing new features and tens of languages support it (C#, Basic, Object Pascal, ASP..)

    Java does bad on GUI's. It's true. OTOH, it doesn't actually do that badly on graphics. It has OpenGL bindings, so for things like making games, it actually does just fine. I'm not personally a big fan of Java, but normal "businessy" GUI apps are really the only are where Java really falls down on performance. And, even then, it's nowhere near as bad as the Java reputation would suggest.

    It's worth pointing out somewhere that the iReversi program in the article doesn't actually seem to touch the GUI at all. I see no menus, search boxes, scrollbars, etc, just whatever window decoration the OS has to offer. The game itself is only graphics, which you point out can make things a lot easier. Basically, this game seems at least on par with the least impressive demonstration of cross-platform code I can imagine. It might as well just be "Hello, World!". How about an office suite like OO.o, an image editor like GIMP, a chat client like Pidgin, or anything that requires actual use of a GUI that so complicates the cross-platform approach?

    Don't show me something simple and tell me it's a demonstration of overcoming a complex and longstanding issue. I can write a web page that renders the same in Firefox 3.6 as it does in IE 5, but that doesn't mean I've created anything special; I just wrote something basic enough that avoids the big issues.

  14. I wish Java won by Billly+Gates · · Score: 2

    But not in its current form.

    Sun never made native executables or a way to point and click on a java file and have it run without having to type java x. As a result desktop apps tended to ignore java. Sun gave away the JDK but had no tools for animation like Adobe. As a result JavaFX was too little too late. Netbeans is nice but I need to drag and drop to create animations and visual effects ... not type lines of code in with an ide.

    Flash loads instantaneously while java applets have to launch a whole java runtime environment which annoys users loads.

    I was thinking of creating some out of spare time but I do not have the mathmatical skills of learning graphical algorithms.

    Sun has an addon for Adobe flash to create javafx applets but if yo uhave adobe flash then why bother making a javafx applet? Ugh

    Since Java is now open sourced as Iced Tea I hope this will change. Java now has a very very bad rap as a 21st century Cobol for server apps and all verbose, dull, and boring with memorizing many layers.of.different,javax,apis.

    So we need a free opensource animation tool and support for point and click java applications. After this Java may or may not take off. I really dispise Adobe. They are a threat to anyone who wants to do web development. Without adobe you can not get a job as a web developer anymore as its the defacto standard. Even html 5 is being undermined by it and silverlight.

  15. Re:all those platforms are yours... by Dragonslicer · · Score: 5, Funny

    look like a retarded snail trying to climb a salt hill.

    Best. Comment. Ever. :)

    Fixed that for you.

  16. Re:all those platforms are yours... by Liquidrage · · Score: 3, Informative

    Really? Reason #4 is enterpise adoption rate. That's changed as .NET is growing. #6 is an opinion with no factual basis backing it up. Having done both Java and .NET web development, I strongly disagree with it. But still, it was nothing more then an unproven assertion.
    #7 is false.
    #8 is another unproven assertion.
    #11 is another unproven assertion.
    #14 is false.
    #16 is complete garbage. Collections and true generics are superior in .NET
    #17 is unproven assertion.
    #20 neglects .NET development work in government Federal and State and local.
    #21 unproven assertion.
    #22 is crap. O/R mappers are huge in .NET land. Your claim that Java's are better is, shockingly, an unproven assertion.
    #23 is an unproven assertion. And you're going against one of the best IDE's ever that many love in this one.
    OK, I got bored and stopped. And most of the other ones on the list I think are crap to. You're talking about programming languages, why even tout such a superficial list that amounts of nothing but sticking out your tongue and going "na-na na-na"?

  17. Harrumph. by sjinsjca · · Score: 2, Funny

    "There's no other platform in the world that can boast this level of flexibility — not even close" Harrumph. LabVIEW.

  18. Re:all those platforms are yours... by Liquidrage · · Score: 3, Insightful

    I think LINQ is a biggest game changer out there right now. It's the biggest thing I've seen in a while. Querying your own object collection is extremely powerful.

  19. Re:all those platforms are yours... by DeionXxX · · Score: 3, Interesting

    There are no GUI widgets in Flash / AS3. Everything is actually drawn on screen using vector or bitmap graphics. There are components that you can use that emulate widgets (drop downs, date pickers, etc) but those are not native. This means that they will work consistently across all platforms.

    This demo is perfect because it shows a Flash / AS3 developer what they need to do to make sure their app works well across devices.

    1. Figure out how your app elements might reposition themselves depending on screen dimensions.
    2. Figure out how to scale your application and elements so things are usable.
    3. Use interactions that work on press and not on MouseOver.

    The rest doesn't matter. As long as the framework can draw graphics to the system consistently across devices, nothing else really matters. Flash is become the ultimate platform for GUI development.