Joine Music

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 19 May 2008

Overview of JavaFX Script - TS-5152

Posted on 07:46 by Unknown
DISCLAIMER:
These are the tidied up notes I took from the session at the JavaOne 2008 conference in San Francisco, California. There may well be mistakes and ommissions. I will come back and correct them once the conference has completed. However my first priority is to get the information published before the backlog gets too large and swamps me. All comments welcome. Enjoy!

Christopher Oliver, Sun Microsystems

Philosphy:
F3 - express GUI's

Learn the lessons from natural language - make JavaFX Script expressive:
- There are rules but also irregularities
- There are function words
- Have both imperative (e.g. java) and declarative (express propositions about the world - functional) moods

... and from existing programming languages:
- Be concise - hit a mark somewhere between verbose (COBOL) and obscure (APL)
- Performance - Mediate between the needs of us and of the machine.
- Be imperative (the C family has won the familiar syntax war - play with the winner)
- But also borrow from declarative languages as well - both functional and niche languages (such as SQL, HTML, XPath/XQuery)
- Finally there is no pre processor so there can be no DSLs and no operator overloading. This means I can read the code no matter who wrote it. This avoids the "Tower of Babel" problem

The Compiler:
- It's OSS - http://openjfx-compiler.dev.java.net
- It's built on javac
- It has similar command line tools - javafxc, javafx, javafxdoc - These are analagous to Java CLI tools

FX Script Features:
- It is integrated with java (so all your java APIs are available to you)
- It is Object Oriented - this allows you to look at the world from the point of view of specific objects - from the 1st person perspective. Otherwise code is from a third person perspective
- It also provides closures & first class functions - borrowed from ECMA script
- There is also multiple inheritance - I may inherit from 1 java class & multiple Java interfaces OR multiple JavaFXScript classes (but no Java classes)
- It has both an imperative and declarative syntax
- It is statically typed (which will provide obvious IDE benefits)
- The concept of time is a first class type with memes provided to manage changes over time such as key frame animation (but without a dependency on graphics - this is used to manage state changes over time)

Declarative Syntax:
- It is an expression language - all constructs are expressions (like Ruby)
- Object literals - this is similar to javascript object literals but FXScript is statically typed. Therefore I can do things like: rectangle { x:10 y:10 }
- This allows me to specify an object graph / document tree declaratively and also in the proper place in the conceptual framework rather than a sequence of instructions out of line (as happens with Java)
- It also has a block expression - {} - delimited with sub expressions seperated by semi colons. It can contain any number of expressions within it. The last expression is the return value of the block. Blocks can be nested.

Collections:
- There are no arrays but FXScript has a construct called a sequence (which contains obejcts but sequences are not objects themselves). They are mutable. sequence comprehension (c.f. set comprehension) allows them to be generated from other sequences. The chosen syntax is like a 'for' loop
- The 'slice' function allows me to obtain a sub range of a sequence
- There are also range expression like in Ruby ([1..4])
- Also literals are declared in [] and seperated with ','

NOTE: Strings can add curly brace contained expressions which are evaluated into the string result (c.f. Ruby). You can do this to tag things to be internationalised / localised - no resource bundle / formatting pain...

Bindings:
- Now we have a declarative language to express a language graph (a scene is comprised of a set of GUI elements) how do we express dynamic elements? Bindings allow you to attach a dynamic expression to change values references in an expression and update object properties. Whenever something is modified, the bound values will be updated automatically
- Bound Function - can be used to create reusable code
- An unbound function is just a procedure like in Java - you can still use them in functions but variable changes dont trigger re evaluation
- A bound function - the return value of the return function, all variables in the closure will trigger it to be re evaluated. No void expressions, no loops, etc.

Example:
- We have a conceptual line, with bound functions which extrapolate values from the features of the line (e.g. length, centrepoint). Some of these depend on other bound functions
- We firstly create the line, and then create the visual properties which depend upon the line. If we change one of the attributes of the line the visual elements will be automatically be updated
- NOTE: a group is a non visual scene graph node which creates a co ordinate space for the elements contained

Imperative Syntax:
- This is like java - if statements, while loops etc.
- There are also unbound functions
- And void expressions - which allow you to express procedural code
- NOTE: JavaFX Script objects are mutable, NOT immutable
- What about sequence modification? - the 'insert' and 'delete' keywords borrowed from SQL for insertion and deletion. Lesson from natural languages
- There are also triggers - Remember your program is about handling cause and effect; your program must handle change. There are already declarative bindings to link one object to another (like the Observer pattern). We can also respond in a procedural way, so if something happens (a trigger) 'on replace' then fires off some procedural function. The body of triggers are void block expressions. There was a change and this is executed to make a further change based on this triggering change

Key Frame Animation:
- This is another mechanism to manage state changes.
- Just to do with object state.
- element: timeline, element: keyframe
- set of states represented as variables 9at a certain time the variable had a certain value. when I run the timeline, at the instance of the keyframes the variables will be assigned the specified values.
Time literatls ('s' is seconds, 'ms' is millis)
[Keyframe {
values: [angle => 0, ...
],
[Keyframe {
values: [angle => 2, ...

- The tween operator - will animate the gaps in the timeline

Questions:
- Do you support generics? No, there is no support yet in JavaFX Script
Email ThisBlogThis!Share to XShare to Facebook
Posted in java javafxscript javaone 2008 fxscript | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • (no title)
    The Significance and Importance of Quotes in JSTL EL I just spent a few hours debuggung a null pointer in a Portlet JSP I'm writing. It...
  • (no title)
    Agile Development Ramblings: Part I Introduction I've just completed my first Agile development project. We developed a fully functiona...
  • EJB 3.0 Outside the Container, Inside the JVM - Part 2: Configuring JPA Declaratively
    Welcome to part two of this blog entry introducing using EJB3.0 inside the JVM. Click here to view the first part. As we've seen, JPA ...
  • Reuse (ii): Definition of Done
    As I said in my previous post , our project has suddenly taken a new path. There are two bits of collateral which I'd recently produced...
  • Notes from the FindBugs BOF9231 at JavaOne 2007
    NOTE: These are my incomplete notes from the FindBugs BOF at JavaOne 2007. I got in late due to the crush outside so missed the start of th...
  • Writing Unit Tests to Ensure Your "@Transactional ... rollbackFor" Annotations are Honoured
    Thanks to Russ Hart for providing the info on how to get this to work.  I just cut and paste, and then blogged it. It's nice to write un...
  • (no title)
    Can Your Own Demo I found something great on t'internet the other day. I had been asked to do a demo of our new ystem to some users but...
  • JavaOne Bred Over-Enthusiasm...
    I want to build and fiddle with Wonderland , and my own JDK ! The problem is my graphics card sucks (I need acceleration) and I'm runnin...
  • Booting Apache Derby ("JavaDB") with your Java App's Startup
    If you're embedding the Derby RDBMS with your java desktop application and want it to start when you start your app, you need to make th...
  • STS and RTC – Getting them to Play Nice
    We’re developing our new app using Spring 3.0 RC1 and we want the best tools available. We’ve picked the following: SpringSource Tools ...

Categories

  • 0
  • 2008
  • ant maven pimp build javaone 2008
  • apple ipod touch
  • asm
  • blog new ruby
  • blogtag list
  • bond casinoroyale mashup mi6 film movie
  • build
  • bytecode
  • CI
  • cobertura
  • communityone 2008 nutter jvm scala jruby groovy davinci
  • communityone 2008 opensocial socialsite
  • communityone javaone keynote oreilly
  • configuration
  • cowley
  • css div layout column ie firefox safari example
  • custom
  • darkstar mpk20 wonderland java3d commaboration SL
  • dashboard rss communication news development
  • db2 database SQL max min howto tip
  • db2 database ibm lessons tips
  • db2 database load batch howto example
  • db2 import upload data howto command
  • debt technical java annotation
  • debugging tips javaone 2008
  • development web2.0
  • findbugs JavaOne 2008 pugh
  • findbugs JavaOne BOF notes
  • gafter closures java javaone notes
  • google trouble patriarchal patriarchy
  • groovy metaprogramming javaone 2008
  • grubby oss data generation project announce
  • guice javaone 2008
  • gwt maven howto example simple
  • howto
  • hudson
  • hudson CI javaone 2008
  • ibm
  • invokeDynamic jvm dynamic ruby javaone
  • itinerant web2.0 portable desktop
  • jacl was websphere wsadmin trace logging
  • james gosling sun java open source tech days second life SL
  • jar java manifest properties config howto tip
  • java
  • java applet javaone 2008 reloaded jnlp
  • java javafxscript javaone 2008 fxscript
  • java javaone 2007 07
  • java javaone 2008 bytecode cobertura asm singleton testability
  • javaone
  • javaone keynote gage schwarz javafx
  • javaone semantic web bof notes web3
  • jazz
  • jruby rails javaone charlesnutter thomasenebo
  • jruby ruby netbeans development
  • kill dead laptop computer rebuild restore
  • lessonslearned
  • mac osx java gui shellscript classpath problem solution
  • maven plugin unittest test packager
  • mylin mylar javaone eclipse 2008
  • netbeans development ide
  • netbeans development ide RC
  • netbeans maven2 profiling
  • netbeans ruby sun tech days visual web pack roman strobl
  • ola bini java javaone 2008 thoughtworks ruby jruby
  • openjdk java javaone javafx wonderland
  • overheard
  • pojo ejb3.0 jpa orm java example howto
  • rant
  • rest restful jsr311 java web2.0 javaone ts-6411
  • rome rss feed blog rss atom propono java javaone
  • rsa uml profile plugin howto
  • ruby inheritance example
  • ruby jruby rss xml hpricot
  • ruby unless example
  • scm
  • setup
  • subversion svn xp windows cleanup
  • sun java soa web2.0 netbeans opensource javacaps
  • sun tech days java derby database rdbms london
  • sun tech days london impressions
  • terracotta java javaone 2008 android gwt
  • tip
  • tips
  • vwp netbeans JPA howto
  • was jython scripting nfr ibm pmi jvm
  • was tpv jython scripting nfr ibm pmi
  • webrick ruby jruby actadiurna investigation code howto
  • workitem

Blog Archive

  • ►  2012 (1)
    • ►  October (1)
  • ►  2010 (8)
    • ►  November (1)
    • ►  October (3)
    • ►  June (1)
    • ►  May (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2009 (9)
    • ►  December (1)
    • ►  November (5)
    • ►  March (2)
    • ►  February (1)
  • ▼  2008 (22)
    • ►  December (1)
    • ►  November (3)
    • ▼  May (15)
      • JavaOne 2008 - Java Recrystalised
      • CommunityOne 2008 - Open Social For Your Website
      • CommunityOne 2008 - The Road to Babel: Bringing th...
      • JRuby at Thoughtworks - BOF-4807
      • Boldly go where the Java programming language has ...
      • Using Findbugs in Anger - TS-6590
      • Overview of JavaFX Script - TS-5152
      • Mylyn: Code at the Speed of Thought - TS-6421
      • Pimp My Build - TS-5596
      • Improving the Engineering Process through Automati...
      • The Future of Guice - BOF-6400
      • Applets Reloaded - TS-6290
      • Advanced Enterprise Debugging Techniques - TS-6072
      • Groovy: The Red Pill (or Metaprogramming : The way...
      • Practical Applications of Static Bytecode Analysis...
    • ►  March (1)
    • ►  January (2)
  • ►  2007 (53)
    • ►  December (1)
    • ►  November (3)
    • ►  September (3)
    • ►  August (2)
    • ►  July (3)
    • ►  June (1)
    • ►  May (12)
    • ►  April (5)
    • ►  March (13)
    • ►  February (7)
    • ►  January (3)
  • ►  2006 (35)
    • ►  December (8)
    • ►  October (1)
    • ►  August (1)
    • ►  July (5)
    • ►  June (8)
    • ►  May (3)
    • ►  April (7)
    • ►  March (2)
Powered by Blogger.

About Me

Unknown
View my complete profile