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.

19 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 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
    2. 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
  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 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

    3. 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.

  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.

  5. 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...

  6. 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!
  7. 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

  8. 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.)

  9. 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.

  10. 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.

  11. 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"?

  12. 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.

  13. 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.