Re: [codenameone-discussions] HTML presentantion layer + CN1

61 views
Skip to first unread message

Steve Hannah

unread,
Jun 19, 2014, 12:43:41 PM6/19/14
to codenameone...@googlegroups.com
While you technically can build an app this way, you are setting yourself up for a bit of a rocky road.  The biggest pitfall is in debugging.  If you stick to the pure Java route, errors are easy to identify and fix because you get stack traces leading your directly to the problem.  Once you introduce Java to Javascript communication and vice versa, errors will become much more difficult to track down.

If you really want to use HTML5, you are probably better to use Cordova.  

As an aside, I'm not sure what you mean by "The clash with Swing's approach of CN1 is clear: we could not rebuild the presentation layer exactly as produce, due the differences on Swing components and HTML redering."  

CN1's model for UI is quite flexible for cross-platform mobile development.  I haven't experienced any issues with making the UI look good across devices.

Steve


On Thu, Jun 19, 2014 at 7:41 AM, <ivan....@gmail.com> wrote:
We have been working with CN1 (and even LWUIT) on last years, and now we are experimenting HTML5 based solutions with WebView (on CN1) for more agile presentation layer change cycle.

Our interface designers accumulate a strong know-how on HTML for multiple devices (basically all sorts of Androids and Ithings), so they expect that the their layout could render exactly as produced on all sorts of mobiles.

The clash with Swing's approach of CN1 is clear: we could not rebuild the presentation layer exactly as produce, due the differences on Swing components and HTML redering.

So, we are raising this discussion to check a proposed solution before invest in it. Here it goes:

  • All the crude data and model actions are kept on server side, accessible through Web Service (JSON based)
  • We will use CN1 WebBrowser to render HTML for presentation
  • HTMLs are located on server side (client side HTML and assets hierarchically organised seems impossible on CN1)
  • All navigation actions on HTML (basically forms and links) are intercepted on CN1, and CN1 code is used to manage all sort of actions that need to be performed (it means that CN1 code has to control user navigation, besides that, have access to filled forms on HTML and interoperate with Web Services).
  • I was thinking about let on server only HTML templates, and embed a template engine on CN1 (using data from Web Service to generate final HTML). Another possibility is to let the server do this job, and CN1 only set the parameters on the HTTP request to pull an already complete HTML.
By this way, we are trying to escape from Native vs "HTML5 base solutions" dichotomy, and organize our product development flow respecting separation of concerns (designers vs developers), and keep CN1 cross-platform development.

Anybody seems it possible, impossible, tried something similar? Please, any advice is welcome. 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/4042e2df-8586-4c4b-b725-8d490d839546%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Web Lite Solutions Corp.

Ivan Stoiev

unread,
Jun 19, 2014, 2:56:58 PM6/19/14
to codenameone...@googlegroups.com
Thanks Shannah!

The idea is not to use Javascript, or use it at a minimal level (code regarding presentation layer only, or some HTML form validation). I think that communication between WebView and CN1 code can be archive with links, forms and BrowserComponent.addWebEventListener("onStart"). Here is the entry point to create a little MVC controller to redirect user to call WebService to perform actions, and redirect user to other HTML page.

Yes, its posible to reach HTML using CN1, but this demand a lot of work too keep things exactly the same (I am egoistically thinking on our product development process, where layouts are planned and delivered by designers with responsive HTML + css)

Another two issue that we pretend to resolve are change management and separation of responsibility. The fist issue (I don`t know if Cordoba can handle it) is that HTML changes could be deployed without updating application, since HTML and assets are kept out of it (some assets could selective be place inside app to save network and time, we've reach it on a native Android WebView once, but I don`t know if its posible on CN1).

On the second issue, separation of responsibility, designers can change HTML templates more freely, with little or none developer supervision.

If proposed solution on CN1 is impossible, there is tradeoffs that we will have to face:
  • Use convencional CN1, trying to delegate CN1 resource to designers and keeping our development team on CN1, with the loss of remote layout change
  • Train our developers on Cordova (Javascript based), I think with the loss of remote layout change too.
Best Regards


On Thursday, June 19, 2014 1:43:41 PM UTC-3, shannah wrote:
While you technically can build an app this way, you are setting yourself up for a bit of a rocky road.  The biggest pitfall is in debugging.  If you stick to the pure Java route, errors are easy to identify and fix because you get stack traces leading your directly to the problem.  Once you introduce Java to Javascript communication and vice versa, errors will become much more difficult to track down.

If you really want to use HTML5, you are probably better to use Cordova.  

As an aside, I'm not sure what you mean by "The clash with Swing's approach of CN1 is clear: we could not rebuild the presentation layer exactly as produce, due the differences on Swing components and HTML redering."  

CN1's model for UI is quite flexible for cross-platform mobile development.  I haven't experienced any issues with making the UI look good across devices.

Steve
On Thu, Jun 19, 2014 at 7:41 AM, <ivan....@gmail.com> wrote:
We have been working with CN1 (and even LWUIT) on last years, and now we are experimenting HTML5 based solutions with WebView (on CN1) for more agile presentation layer change cycle.

Our interface designers accumulate a strong know-how on HTML for multiple devices (basically all sorts of Androids and Ithings), so they expect that the their layout could render exactly as produced on all sorts of mobiles.

The clash with Swing's approach of CN1 is clear: we could not rebuild the presentation layer exactly as produce, due the differences on Swing components and HTML redering.

So, we are raising this discussion to check a proposed solution before invest in it. Here it goes:

  • All the crude data and model actions are kept on server side, accessible through Web Service (JSON based)
  • We will use CN1 WebBrowser to render HTML for presentation
  • HTMLs are located on server side (client side HTML and assets hierarchically organised seems impossible on CN1)
  • All navigation actions on HTML (basically forms and links) are intercepted on CN1, and CN1 code is used to manage all sort of actions that need to be performed (it means that CN1 code has to control user navigation, besides that, have access to filled forms on HTML and interoperate with Web Services).
  • I was thinking about let on server only HTML templates, and embed a template engine on CN1 (using data from Web Service to generate final HTML). Another possibility is to let the server do this job, and CN1 only set the parameters on the HTTP request to pull an already complete HTML.
By this way, we are trying to escape from Native vs "HTML5 base solutions" dichotomy, and organize our product development flow respecting separation of concerns (designers vs developers), and keep CN1 cross-platform development.

Anybody seems it possible, impossible, tried something similar? Please, any advice is welcome. 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

Shai Almog

unread,
Jun 20, 2014, 12:40:18 AM6/20/14
to codenameone...@googlegroups.com
I agree with Steve here.
You will need to make a choice. You can achieve most HTML based designs relatively easily with Codename One but obviously you will need to retrain or pick up some of the work the designers would normally do.

Ivan Stoiev

unread,
Jun 20, 2014, 11:32:57 AM6/20/14
to codenameone...@googlegroups.com
Thank you guys, we will discuss internally, if we reach some sort of innovative solution for all this, we share it.

:)
Reply all
Reply to author
Forward
0 new messages