Two Laptop Bag*
The moose likes HTML, CSS and JavaScript and the fly likes JavaFX and application structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaFX and application structure" Watch "JavaFX and application structure" New topic
Author

JavaFX and application structure

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Jim, given what little I've read of JavaFX (mostly here this week), I'm wondering how you see JavaFX affecting RIA structure. I can envision two types of app structure: (of course, everything in between is possible as well -- or even something completely different)

1) Apps similar to today's RIA's. Model, business logic, and control on server. View generation on server (JSP et al) goes away in favor of display-only JavaFX code on client. Lots of communication with the server delivering small requests. JavaFX, in effect, takes place of HTML/JavaScript Ajax front-end.

In this scenario, the server code is pretty much unchanged from today's RIA's with the exception of removing page-generation.

2) Full MVC moves to the client with the Model replicated via HTTP from the server.

In this scenario, the server code is drastically changed to merely keep track of the persisted Model and feed it to the fat client. At what point does it stop being a RIA and just become a RA (aka desktop client/server app)?

Which do you see happening? Why?
[ April 02, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
James Weaver
author
Ranch Hand

Joined: Oct 11, 2007
Posts: 40
My preference is a blend of the two approaches that you mentioned. JavaFX Script is meant to be used in such a way that the UI is declaratively expressed, and bound to a model that is articulated in JavaFX classes. I like to use a lightweight model that has the responsibility of interacting with the server as necessary. So the model holds data necessary for the UI in an MVC fashion. That data is often state (such as currently selected element in a ListBox), as well as data from the server (cached in some cases for optimization). Because JavaFX can access Java classes directly, the functions in the model classes have many choices in how they communicate with the server (wrapping Java classes, or using JavaFX JSON/XML libraries, etc.)

The Freebase Browser post has a diagram that represents the architectural pattern that I've been using.


Thanks,<br />James L. (Jim) Weaver<br /><a href="http://JavaFXpert.com" target="_blank" rel="nofollow">"Helping you become a JavaFXpert" weblog</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

I see. Interesting hybrid. I assume that the MVC architecture on the client is still display-focused and that business logic remains on the server in that scenario?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

I've seen/heard-of some RIAs where this sort of thing -- implementing a full MVC app -- on the client, in JavaScript no less -- is done. The business logic remains on the server and the client-side Model only contains what data is necessary to keep the UI "fed".

It's not an app structure I've investigated deeply, but just pointing out that there's precedent for the type of app construct James is talking about, if I am understanding him correctly.
[ April 03, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaFX and application structure