Developing for multiple platforms/modes simultaneously

edited September 2014 in Questions about Modes

At the moment I'm developing an app that I want to run as a web page and as an Android app, and maybe also a Java applet just because I'm getting better performance in that than anything else. The problem with doing this in Processing is, of course, that there are a few bits of language that are still different enough to need re-writing for different platforms and modes.

I'm just wondering if there's a more elegant way of dealing with this than having blocks of code in your sketch which you comment out or put back in depending on which mode you're targetting?

Answers

  • The go-to answer for this is that you shouldn't be deploying the same application to multiple platforms. An application designed for a touch screen is different than an application for a mouse. An application designed to be downloaded is different than a web application.

    That's not a very satisfying answer, but trying to build a one-size-fits-all application will just mean your users on every platform are less satisfied. Instead, you should be designing the UI from the ground up for each platform.

    Or if you want to ignore that advice, you could also just use if statements that do different things depending on the platform. That way you only need to change one variable instead of commenting out a bunch of code.

  • The UI for this thing only has three controls, and I'm not too bothered about whether they're activated by tapping the left and right of the screen, keys on the keyboard or arcade-style buttons on a dedicated case!

    The trouble with 'if' statements is that the Processing IDE chokes on slightly different syntax, so that's not reliable either. :-/

  • edited September 2014 Answer ✓

    The trouble with 'if' statements is that the Processing IDE chokes on slightly different syntax...

    It's true that even if we try to stick as much to Processing's IDE, Java to JS mode conversion can still fail.
    Despite that, I've still had many cross Java-JS modes successful cases! <:-P
    And I don't think C-style if statements would be a problem! :-?

    Your problem is that there's no cross Android-JS modes! :(
    IMO, you should focus on web apps only for reasonable cross-platform dev!
    And newest P5.JS framework project brings up another Processing API for JS language syntax. (*)

    Check it out these cross-mode sketch examples:

Sign In or Register to comment.