Java SE and Javafx: the Road Ahead
Total Page:16
File Type:pdf, Size:1020Kb
<Insert Picture Here> Java SE and JavaFX: The Road Ahead Danny Coward June 2010 Java is 15 – Happy Birthday ! Java's evolution Java ME, SE, JavaCard EE open Java EE sourced JDK 1.0 1995 2000 2005 2010 Java JavaFX Community Process created Java ME Before 1995... Java SE 7 and JDK 7 © 2008 Oracle Corporation – Proprietary and Confidential Java modularity • Java's growing waistline • Modularity – JSR 294: Language Support for Modular Programming – Project Jigsaw: A low-level module system, applied to the JDK • Size, Scalability, Speed Many modules, many dependencies Less modules, less dependencies Parallelism • To get traffic flowing faster on roads, planners don't raise the speed limit, they build more lanes ! • Systems have turned to multiple cores and multiple processors to fullfil Moore's Law Parallelism in Java • Garbage First Collector – Parallel – Generational – Compacting – Predictable • Fork/Join Framework APIs – Break big task into lots of independent small ones – Reassemble results Multiple Languages Sleep Funnel Bex Script WebL Tea Zigzag JESS iScript Modula-2 CAL Lisp Jickle Simkin Nice JavaScript Correlate Drools JudoScript Simkin Basic Groovy Eiffel v-language Icon Luck Prolog Mini Pascal Tcl PLAN Hojo Scala Tiger Rexx JavaFX Script Yassl Anvil foo Oberon FScript E Smalltalk Logo Tiger JRuby Clojure JHCR Pnuts G Dawn Phobos Processing Sather Jython LLP TermWare Ada Scheme Piccola BeanShell Forth C# PHP ObjectScript Yoix SALSA DaVinci Project • Allows JVM to optimize non-Java language features – Method handles – Invokedynamic – Already in JDK 7 builds New Java language features • Modularity • Annotations (JSR 308) • Small changes (Project Coin) • Closures (Project Lambda) Diamond Type inference // Before Map<Bar, Foo> map1 = new HashMap<Bar, Foo>(); Map<Bar, List<Foo>> map2 = new HashMap<Bar, List<Foo>>(); Map<Bar, List<List<Foo>>> map3 = new HashMap<Bar, List<List<Foo>>>(); // After Map<Bar, Foo> map1 = new HashMap<>(); Map<Bar, List<Foo>> map2 = new HashMap<>(); Map<Bar, List<List<Foo>>> map3 = new HashMap<>(); Better Exception handling // doWork() throws Except1 and Except2 // Before try { doWork(file); } catch (Except1 e1){ logger.log(e1); throw e1; } catch (Except2 e2) { logger.log(e2); Throw e2; } Better Exception handling // After try { doWork(file); } catch (final Except1 | Except2 ex){ logger.log(ex); throw ex; } Automatic Resource Management // Before static void copy(String src, String dest) throws IOException { InputStream in = new FileInputStream(src); try { OutputStream out = new FileOutputStream(dest); try { byte[] buf = new byte[8192]; int n; while ((n = in.read(buf)) >= 0) out.write(buf, 0, n); } finally { out.close(); } } finally { in.close(); } } Automatic Resource Management // After ? static void copy(String src, String dest) throws IOException { try (InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest)) { byte[] buf = new byte[8192]; int n; while ((n = in.read(buf)) >= 0) out.write(buf, 0, n); } Strings in Switch statements // After... String s = ... switch(s) { case "quux": processQuux(s); // fall-through case "foo": case "bar": processFooOrBar(s); break; case "baz": processBaz(s); // fall-through default: processDefault(s); break; Closures // Before double highestGpa = students.filter(new Predicate<Student>() { public boolean op(Student s) { return s.gradYear == 2009; } }).map(new IntExtractor<Student>() { public int extract(Student s) { return s.gpa; } }).max(); Closures // After double highestGpa = students.filter({Student s => s.gradYear == 2009}) .map({Student s => s.gpa}) .max(); " And much more for JDK 7... • NIO.2 (JSR 203) • Compressed OOP 64 bit VM • Upgrade class-loader architecture • Stream Control Transmission Protocol • Sockets Direct Protocol (SDP) • Elliptic-curve cryptography • Unicode 5.2 support ... JavaFX © 2008 Oracle Corporation – Proprietary and Confidential JavaFX: 4 releases in 18 months ! JavaFX 1.0 JavaFX 1.2 JavaFX 1.3 Desktop UI Components More UI Components JavaFX Script Layouts Performance Scenegraph Performance Composer Web Services TV Media JavaFX 1.1 Mobile 2009 2010 JavaFX 1.3 – New UI Components JavaFX 1.3 Performance • Optimized binding • Scalability of the scenegraph • Better startup with Java SE 6 Update 18 • EA new graphics stack: Prism JavaFX 1.3 TV is here • Finalized from JavaFX 1.2 release • Support TV navigation • JavaFX TV Emulator Thankyou • JDK 7: openjdk.java.net • JavaFX: javafx.com The End © 2008 Oracle Corporation – Proprietary and Confidential <Insert Picture Here> Presentation Title Logo Here Presenter’s Name Presenter’s Title Date (Optional) Section Divider © 2008 Oracle Corporation – Proprietary and Confidential Base Content Slide (Title 24 Bold) Optional Sub Title (size 18) • First-level bullet – Second-level bullet • Third-level bullet – Fourth-level bullet • Fifth-level bullet © 2008 Oracle Corporation – Proprietary and Confidential.