On May 6, 6:40 pm, Joshua Marinacci <[email protected]> wrote:
> I would really like to hear back from Ed.  He is not the first person  
> to have a bad reaction to JavaFX initially.  There seems to be some  
> sort of a mental hurdle that a lot of people face, including myself 2  
> years ago. Once they play with it enough they suddenly 'get it' and  
> become happy and very productive, even with the earlier buggy  
> releases.  I've heard from many smart people going through this, so  
> clearly there is more going on here than just "It's different, so I  
> don't like it".  Perhaps we are presenting the language improperly, or  
> we are demonstrating the wrong features first.  I'm not sure what's  
> going on but I'd like to dig down into it and find out.


As the author of one of the JavaFX books (and therefore charged with
the task of explaining JavaFX to others) I might be able to cast a
little light on that.

Prior to the print version, the book gets frequent electronic releases
as it is being written.  It also goes through periodic reviews at key
stages, from a variety of interested parties -- some experts, others
novices.  All of these readers generate feedback which helps shape the
manuscript.  It means I have a rare insight into which parts of JFX
are causing 'confusion'.

The follow are some common 'barriers' I've found, plus explanations of
each for anyone struggling...

#1 -- JavaFX Script is an expression language, with a declarative
syntax.

This means it acts as both a way of writing code, and defining
structure, **AT THE SAME TIME** (unlike Flex or Silverlight, which use
separate languages for each.)  The declarative syntax allows us to
build complex data structures (eg: user interfaces) such that the
structure of the code mirrors the structure of the data.  Meanwhile,
as constructs like IF/THEN, FOR, etc. are expressions, code can be
used to populate any part of the structure.

In a nutshell: you have to think less procedurally (step 1, step 2,
step 3...), and more in terms of code interwoven into nested data
structures.


#2 -- Binding permits Model/View/Controller, without the boilerplate
(yaaaaay! :)

In Java if I want Object A to automatically respond to changes in
Object B, I need to use a model object, a listener interface, and
(possibly) an event object to pass between model and listener.  In
JavaFX any object/variable can respond to changes in another by
creating a bound relationship -- in effect any (accessible) variable
can emit updates which others can consume to update themselves,
**WITHOUT ANY MODEL/EVENT/LISTENER BOILERPLATE**.

In a nutshell: Just because other languages make you jump through
hoops to implement common UI techniques, don't assume JFX does.


#3 -- Sequences are not (really) arrays.

I'm guilty myself of muddying the waters on this matter in early
drafts of my book, until someone from Sun kindly noted how much
confusion it might cause.  Although sequences can be treated as one
dimensional arrays, under the hood they pack quite a punch.  While
arrays just store data verbatim, sequences are more abstract and might
be said to have a 'view' (in a loose sense) on it -- something which I
hope future versions of the language will build upon to create more
complex filtering and sorting functionality.

In a nutshell: When software mainly dealt with RAM, language variable
types were designed accordingly.  Now databases etc are more common,
languages should be a bit more sophisticated.  JFX is, perhaps, a
small step in that direction.


Okay, so I brushed over a lot of detail in the above.  There's more to
be said about all three topics, but you can only say it once the
basics have 'clicked' in the reader's mind.  For example, I can't tell
you how many comments I got saying "you haven't shown us how to do MVC
in JavaFX??; where's the MVC??; how do I do MVC?!?!", when there was
an *entire* chapter devoted to a very clean-cut model/UI type project
-- but the readers just didn't see it.  They expected 'big and heavy'
like Java, so they failed to notice the nibble little binds constantly
updating the UI as the data object changed.

Does any of this ring true with anyone 'struggling' with JavaFX
here...?  Are there any other sources of confusion you're
encountered?  I'd be interested to know.


Gratuitous plug for the book: (JavaFX in Action)  http://www.manning.com/morris/

Simon Morris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to