SlideShare a Scribd company logo
XML-Free Programming : Java Server and Client Development Without <> Stephen Chin Chief Agile Methodologist, GXS steveonjava@gmail.com tweet: @steveonjava Arun Gupta Oracle Corporation arun.p.gupta@oracle.com tweet: @arungupta
Meet the Presenters Stephen Chin Arun Gupta Community Guy Family Man Motorcyclist Marathoner
Our Plan Quick (Humorous) History of Angle Brackets XML-Free Programming Configuration Lives with the Code Data Transfer Models the Domain Design Programming Languages for Humans JavaOne Speakers Application <Demo> 3
Exhibit A – Angle Bracket Sighting in Virginia, 1922 Source: Library of Congress, Prints and Photographs Collection – Public Domain http://www.flickr.com/photos/pingnews/434444310/ 4 > > >
Exhibit B - Bermuda Tri-Angle Brackets Source: NOAA National Ocean Service – CC licensed http://www.flickr.com/photos/usoceangov/4276194691/sizes/o/in/photostream/ 5 > > >
Exhibit C – Tim Bray, Co-Founder of XML Source: Linux.com http://www.linux.com/archive/feature/133149 6 > > > >
History of XML Based on Standard Generalized Markup Language (SGML) Created by a W3C working group of eleven members Version History: XML 1.0 (1998) – Widely adopted with 5 subsequent revisions XML 1.1 (2004) – Limited adoption 7
XML Design Goals (a.k.a. problems with SGML) Usable Over the Internet Support a Wide Variety of Applications Compatible with SGML Easy to Write Programs to Process XML Documents Minimum Number of Optional Features Documents Should be Human-Legible and Reasonably Clear Design Should be Prepared Quickly Design Should be Formal and Concise Documents Should be Easy to Create Terseness in Markup is of Minimal Importance 8
Design Goals Per Application 9
Tenet 1 Configuration Lives with the Code 10
Letting Go of XML is Hard! 11 This is not intended as a replacement for Spring's XML format. Rod Johnson on Spring’s Annotations-based Configuration “A Java configuration option for Spring,” 11/28/06
Java EE 6 Annotations @Stateless @Path @WebServlet @Inject @Named @Entity 12
But There is Hope! 13 You can have a Groovy DSL … it is as short as can be. Dierk Koenig on Canoo Web Test “Interview with Dierk Koenig,” ThirstyHead.com 6/3/2009
Canoo Web Test Comparison XML Groovy Builder <project default="test">  <target name="test">  <webtest        name="Google WebTest Search">    <invoke url="http://www.google.com/ncr" />    <verifyTitle text="Google" />    <setInputField name="q" value="WebTest" />    <clickButton label="I'm Feeling Lucky" />    <verifyTitle text="Canoo WebTest" />  </webtest> </target></project> class SimpleTest extends WebtestCase { void testWebtestOnGoogle() {  webtest("Google WebTestSearch") {   invoke "http://www.google.com/ncr"   verifyTitle "Google"   setInputField name: "q", value: "WebTest"   clickButton "I'm Feeling Lucky"   verifyTitle "CanooWebTest"  } }} 14
Tenet 2 Data Transfer Models the Domain 15
JavaScript Object Notation (JSON) Matches Relational/Object-Oriented Structures Easy to Read and Write Simple to Parse and Generate Familiar to Programmers of the C-family of languages: C, C++, C#, Java, JavaScript, Perl, Python, etc. Very Simple Specification 16
JSON Syntax in a Slide 17 Images courtesy: http://www.json.org/
JAX-RS Sample 18 @GET     @Produces({"application/json", "application/xml"})     public List<Sezzion> findAll() {         return super.findAll();     }     @GET @Path("{from}/{to}")     @Produces({"application/xml", "application/json"})     public List<Sezzion> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {         return super.findRange(new int[]{from, to});     } @Stateless @Path("sezzion") public class SezzionFacadeREST extends AbstractFacade<Sezzion> { @PersistenceContext     private EntityManagerem; @POST @Consumes({"application/json", "application/xml"})     public void create(Sezzion entity) { super.create(entity);     }
Tenet 3 Design Programming Languages for Humans 19
Counter Example – o:XML Created By Martin Klang in 2002 Object Oriented Language Features: Poymorphism Function Overloading Exception Handling Threads 20 Diagram from: http://www.o-xml.org/documentation/o-xml-tool-chain.html
String Replacement in o:XML vs. Java <?xml-stylesheethref="../xsl/default.xsl" type="text/xsl"?> <program>   <o:function name="ex:replace">     <o:param name="input" type="String"/>     <o:param name="from" type="String"/>     <o:param name="to" type="String"/>     <o:do>       <o:variable name="result"/>       <o:while test="contains($input, $from)">         <o:set result="concat($result, substring-before($input, $from), $to)"/>         <o:set input="substring-after($input, $from)"/>       </o:while>       <o:return select="concat($result, $input)"/>     </o:do>   </o:function> </program> class Replace {   public String replace(String input, String from, String to) { StringBuilder result = new StringBuilder(); int last = 0; int index = 0;     while ((index = input.indexOf(from, last)) != -1) { result.append(input.substring(last, index)); result.append(to);       last = index + from.length()     } result.append(input.substring(last));     return result.toString();   } } 21 16 Lines 461 Characters 14 Lines 319 Characters
String Replacement in o:XML <?xml-stylesheethref="../xsl/default.xsl" type="text/xsl"?> <program>   <o:function name="ex:replace">     <o:param name="input" type="String"/>     <o:param name="from" type="String"/>     <o:param name="to" type="String"/>    <o:do>      <o:variable name="result"/>      <o:while test="contains($input, $from)">        <o:set result="concat($result, substring-before($input, $from), $to)"/>        <o:set input="substring-after($input, $from)"/>      </o:while>      <o:return select="concat($result, $input)"/>    </o:do>   </o:function> </program> 22
Equivalent Java class Replace {   public String replace(String input, String from, String to) { StringBuilder result = new StringBuilder(); int last = 0; int index = 0;     while ((index = input.indexOf(from, last)) != -1) { result.append(input.substring(last, index)); result.append(to);      last = index + from.length()    } result.append(input.substring(last));    return result.toString();   } } 23
Simple Java class Replace {   public String replace(String input, String from, String to) {    return input.replaceAll(from, to)   } } 24
JavaFX 2.0 Powerful graphics, animation, and media capabilities Deploys in the browser or on desktop Includes builders for declarative construction Alternative languages can also be used for simpler UI creation GroovyFX ScalaFX Visage 25
26 Hello JavaOne (Java Version) public class HelloJavaOne extends Application {   public static void main(String[] args) {     launch(HelloJavaOne.class, args);   }   @Override   public void start(Stage primaryStage) { primaryStage.setTitle("Hello JavaOne");     Group root = new Group();     Scene scene = new Scene(root, 400, 250, Color.ALICEBLUE);     Text text = new Text(); text.setX(105); text.setY(120); text.setFont(new Font(30)); text.setText("Hello JavaOne"); root.getChildren().add(text);         primaryStage.setScene(scene); primaryStage.show();   } }
27 Hello JavaOne(Builder Version) public void start(Stage primaryStage) { primaryStage.setTitle("Hello JavaOne"); primaryStage.setScene(SceneBuilder.create()     .width(400)     .height(250)     .fill(Color.ALICEBLUE)     .root( GroupBuilder.create().children( TextBuilder.create()         .x(105) .y(120)         .text("Hello JavaOne")         .font(new Font(30))         .build()       ).build()     )   .build()); primaryStage.show(); }
28 Hello JavaOne (GroovyFX Version) GroovyFX.start { primaryStage -> defsg = new SceneGraphBuilder() sg.stage(    title: 'Hello JavaOne',    show: true) {   scene(        fill: aliceblue,        width: 400,        height: 250) {     text(            x: 105,            y: 120,            text: "Hello JavaOne"            font: "30pt")     }   } }
29 Hello JavaOne (ScalaFX Version) object HelloJavaOne extends JFXApp {   stage = new Stage {     title = "Hello JavaFX"     width = 400     height = 250     scene = new Scene {       fill = BLUE      Text {        x = 105        y = 120         text = "Hello JavaOne"        font = Font(size: 30)      }     }   } }
30 Hello JavaOne (Visage Version) Stage { title: "Hello JavaOne" width: 400 height: 250 scene: Scene {   fill: BLUE   content: Text {      x: 105      y: 120      text: "Hello JavaOne"       font: Font {size: 30pt}    }   } }
JavaOne Speakers Application End-to-end application with no XML coding Server written using JavaEE 6 annotations Data transfer uses JSON Client written in JavaFX 2.0 31
Finished Application 32
Support the Freedom From XML Petition http://steveonjava.com/freedom-from-xml/ Provide Non-XML Alternatives For: Declarative Programming Configuration Data Transfer 33 </> Sign the Petition Today!
34 Stephen Chin steveonjava@gmail.com tweet: @steveonjava Arun Gupta arun.p.gupta@oracle.com tweet: @arungupta

More Related Content

What's hot

Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming Language
Uehara Junji
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践
Jacky Chi
 
FP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaFP - Découverte de Play Framework Scala
FP - Découverte de Play Framework Scala
Kévin Margueritte
 
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD MessagesEWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
Rob Tweed
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
jeresig
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Arun Gupta
 
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of SzegedLecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Fabian Jakobs
 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
Tobias Oetiker
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance DjangoDjangoCon2008
 
Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
Hiroshi Nakamura
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Luciano Mammino
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
Remy Sharp
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
Robbie Cheng
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
Eric Palakovich Carr
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
tepsum
 
From framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytvFrom framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytv
CodelyTV
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
ZendCon
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
JWORKS powered by Ordina
 
Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异
Open Party
 
ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?
장현 한
 

What's hot (20)

Groovy, Transforming Language
Groovy, Transforming LanguageGroovy, Transforming Language
Groovy, Transforming Language
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践
 
FP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaFP - Découverte de Play Framework Scala
FP - Découverte de Play Framework Scala
 
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD MessagesEWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5
 
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of SzegedLecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
 
LISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial HandoutsLISA Qooxdoo Tutorial Handouts
LISA Qooxdoo Tutorial Handouts
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
 
Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
 
Open Source Ajax Solution @OSDC.tw 2009
Open Source Ajax  Solution @OSDC.tw 2009Open Source Ajax  Solution @OSDC.tw 2009
Open Source Ajax Solution @OSDC.tw 2009
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
 
From framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytvFrom framework coupled code to #microservices through #DDD /by @codelytv
From framework coupled code to #microservices through #DDD /by @codelytv
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
 
Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异
 
ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?
 

Viewers also liked

Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and VisageHacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Stephen Chin
 
XML Free Programming - Brazil
XML Free Programming - BrazilXML Free Programming - Brazil
XML Free Programming - BrazilStephen Chin
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)
Stephen Chin
 
55 New Things in Java 7 - Brazil
55 New Things in Java 7 - Brazil55 New Things in Java 7 - Brazil
55 New Things in Java 7 - BrazilStephen Chin
 
Crazy JSRs
Crazy JSRsCrazy JSRs
Crazy JSRs
Stephen Chin
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java Workshop
Stephen Chin
 

Viewers also liked (6)

Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and VisageHacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
 
XML Free Programming - Brazil
XML Free Programming - BrazilXML Free Programming - Brazil
XML Free Programming - Brazil
 
Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)Mary Had a Little λ (QCon)
Mary Had a Little λ (QCon)
 
55 New Things in Java 7 - Brazil
55 New Things in Java 7 - Brazil55 New Things in Java 7 - Brazil
55 New Things in Java 7 - Brazil
 
Crazy JSRs
Crazy JSRsCrazy JSRs
Crazy JSRs
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java Workshop
 

Similar to XML-Free Programming

ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
Guillaume Laforge
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
Carol McDonald
 
Intro to JavaFX & Widget FX
Intro to JavaFX & Widget FXIntro to JavaFX & Widget FX
Intro to JavaFX & Widget FX
Stephen Chin
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
Tugdual Grall
 
當ZK遇見Front-End
當ZK遇見Front-End當ZK遇見Front-End
當ZK遇見Front-End
祁源 朱
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
SoftServe
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
Ory Segal
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
Tugdual Grall
 
mobl
moblmobl
mobl
zefhemel
 
Basic testing with selenium
Basic testing with seleniumBasic testing with selenium
Basic testing with selenium
Søren Lund
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
ciklum_ods
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
Imre Nagi
 
GWT Extreme!
GWT Extreme!GWT Extreme!
GWT Extreme!
cromwellian
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
Patrick Chanezon
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
Matt Raible
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
Tushar B Kute
 
Nativescript angular
Nativescript angularNativescript angular
Nativescript angular
Christoffer Noring
 

Similar to XML-Free Programming (20)

ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Intro to JavaFX & Widget FX
Intro to JavaFX & Widget FXIntro to JavaFX & Widget FX
Intro to JavaFX & Widget FX
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
 
My java file
My java fileMy java file
My java file
 
當ZK遇見Front-End
當ZK遇見Front-End當ZK遇見Front-End
當ZK遇見Front-End
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 
Os Secoske
Os SecoskeOs Secoske
Os Secoske
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
mobl
moblmobl
mobl
 
Basic testing with selenium
Basic testing with seleniumBasic testing with selenium
Basic testing with selenium
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
GWT Extreme!
GWT Extreme!GWT Extreme!
GWT Extreme!
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
 
Nativescript angular
Nativescript angularNativescript angular
Nativescript angular
 

More from Stephen Chin

DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2
Stephen Chin
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community
Stephen Chin
 
Java Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive GuideJava Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive Guide
Stephen Chin
 
DevOps Tools for Java Developers
DevOps Tools for Java DevelopersDevOps Tools for Java Developers
DevOps Tools for Java Developers
Stephen Chin
 
Java Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJCJava Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJC
Stephen Chin
 
RetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming ConsoleRetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming Console
Stephen Chin
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)
Stephen Chin
 
Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)
Stephen Chin
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego Workshop
Stephen Chin
 
Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)
Stephen Chin
 
Confessions of a Former Agile Methodologist
Confessions of a Former Agile MethodologistConfessions of a Former Agile Methodologist
Confessions of a Former Agile Methodologist
Stephen Chin
 
Internet of Things Magic Show
Internet of Things Magic ShowInternet of Things Magic Show
Internet of Things Magic Show
Stephen Chin
 
Zombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the UndeadZombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the Undead
Stephen Chin
 
Oracle IoT Kids Workshop
Oracle IoT Kids WorkshopOracle IoT Kids Workshop
Oracle IoT Kids Workshop
Stephen Chin
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and Devices
Stephen Chin
 
Java on Raspberry Pi Lab
Java on Raspberry Pi LabJava on Raspberry Pi Lab
Java on Raspberry Pi Lab
Stephen Chin
 
Java 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and LegosJava 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and Legos
Stephen Chin
 
DukeScript
DukeScriptDukeScript
DukeScript
Stephen Chin
 
Devoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopDevoxx4Kids NAO Workshop
Devoxx4Kids NAO Workshop
Stephen Chin
 
Raspberry Pi Gaming 4 Kids (Devoxx4Kids)
Raspberry Pi Gaming 4 Kids (Devoxx4Kids)Raspberry Pi Gaming 4 Kids (Devoxx4Kids)
Raspberry Pi Gaming 4 Kids (Devoxx4Kids)
Stephen Chin
 

More from Stephen Chin (20)

DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community
 
Java Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive GuideJava Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive Guide
 
DevOps Tools for Java Developers
DevOps Tools for Java DevelopersDevOps Tools for Java Developers
DevOps Tools for Java Developers
 
Java Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJCJava Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJC
 
RetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming ConsoleRetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming Console
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)
 
Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego Workshop
 
Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)
 
Confessions of a Former Agile Methodologist
Confessions of a Former Agile MethodologistConfessions of a Former Agile Methodologist
Confessions of a Former Agile Methodologist
 
Internet of Things Magic Show
Internet of Things Magic ShowInternet of Things Magic Show
Internet of Things Magic Show
 
Zombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the UndeadZombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the Undead
 
Oracle IoT Kids Workshop
Oracle IoT Kids WorkshopOracle IoT Kids Workshop
Oracle IoT Kids Workshop
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and Devices
 
Java on Raspberry Pi Lab
Java on Raspberry Pi LabJava on Raspberry Pi Lab
Java on Raspberry Pi Lab
 
Java 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and LegosJava 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and Legos
 
DukeScript
DukeScriptDukeScript
DukeScript
 
Devoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopDevoxx4Kids NAO Workshop
Devoxx4Kids NAO Workshop
 
Raspberry Pi Gaming 4 Kids (Devoxx4Kids)
Raspberry Pi Gaming 4 Kids (Devoxx4Kids)Raspberry Pi Gaming 4 Kids (Devoxx4Kids)
Raspberry Pi Gaming 4 Kids (Devoxx4Kids)
 

Recently uploaded

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 

Recently uploaded (20)

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 

XML-Free Programming

  • 1. XML-Free Programming : Java Server and Client Development Without <> Stephen Chin Chief Agile Methodologist, GXS steveonjava@gmail.com tweet: @steveonjava Arun Gupta Oracle Corporation arun.p.gupta@oracle.com tweet: @arungupta
  • 2. Meet the Presenters Stephen Chin Arun Gupta Community Guy Family Man Motorcyclist Marathoner
  • 3. Our Plan Quick (Humorous) History of Angle Brackets XML-Free Programming Configuration Lives with the Code Data Transfer Models the Domain Design Programming Languages for Humans JavaOne Speakers Application <Demo> 3
  • 4. Exhibit A – Angle Bracket Sighting in Virginia, 1922 Source: Library of Congress, Prints and Photographs Collection – Public Domain http://www.flickr.com/photos/pingnews/434444310/ 4 > > >
  • 5. Exhibit B - Bermuda Tri-Angle Brackets Source: NOAA National Ocean Service – CC licensed http://www.flickr.com/photos/usoceangov/4276194691/sizes/o/in/photostream/ 5 > > >
  • 6. Exhibit C – Tim Bray, Co-Founder of XML Source: Linux.com http://www.linux.com/archive/feature/133149 6 > > > >
  • 7. History of XML Based on Standard Generalized Markup Language (SGML) Created by a W3C working group of eleven members Version History: XML 1.0 (1998) – Widely adopted with 5 subsequent revisions XML 1.1 (2004) – Limited adoption 7
  • 8. XML Design Goals (a.k.a. problems with SGML) Usable Over the Internet Support a Wide Variety of Applications Compatible with SGML Easy to Write Programs to Process XML Documents Minimum Number of Optional Features Documents Should be Human-Legible and Reasonably Clear Design Should be Prepared Quickly Design Should be Formal and Concise Documents Should be Easy to Create Terseness in Markup is of Minimal Importance 8
  • 9. Design Goals Per Application 9
  • 10. Tenet 1 Configuration Lives with the Code 10
  • 11. Letting Go of XML is Hard! 11 This is not intended as a replacement for Spring's XML format. Rod Johnson on Spring’s Annotations-based Configuration “A Java configuration option for Spring,” 11/28/06
  • 12. Java EE 6 Annotations @Stateless @Path @WebServlet @Inject @Named @Entity 12
  • 13. But There is Hope! 13 You can have a Groovy DSL … it is as short as can be. Dierk Koenig on Canoo Web Test “Interview with Dierk Koenig,” ThirstyHead.com 6/3/2009
  • 14. Canoo Web Test Comparison XML Groovy Builder <project default="test"> <target name="test"> <webtest        name="Google WebTest Search">    <invoke url="http://www.google.com/ncr" />    <verifyTitle text="Google" />    <setInputField name="q" value="WebTest" />    <clickButton label="I'm Feeling Lucky" />    <verifyTitle text="Canoo WebTest" />  </webtest> </target></project> class SimpleTest extends WebtestCase { void testWebtestOnGoogle() {  webtest("Google WebTestSearch") {   invoke "http://www.google.com/ncr"   verifyTitle "Google"   setInputField name: "q", value: "WebTest"   clickButton "I'm Feeling Lucky"   verifyTitle "CanooWebTest"  } }} 14
  • 15. Tenet 2 Data Transfer Models the Domain 15
  • 16. JavaScript Object Notation (JSON) Matches Relational/Object-Oriented Structures Easy to Read and Write Simple to Parse and Generate Familiar to Programmers of the C-family of languages: C, C++, C#, Java, JavaScript, Perl, Python, etc. Very Simple Specification 16
  • 17. JSON Syntax in a Slide 17 Images courtesy: http://www.json.org/
  • 18. JAX-RS Sample 18 @GET @Produces({"application/json", "application/xml"}) public List<Sezzion> findAll() { return super.findAll(); } @GET @Path("{from}/{to}") @Produces({"application/xml", "application/json"}) public List<Sezzion> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { return super.findRange(new int[]{from, to}); } @Stateless @Path("sezzion") public class SezzionFacadeREST extends AbstractFacade<Sezzion> { @PersistenceContext private EntityManagerem; @POST @Consumes({"application/json", "application/xml"}) public void create(Sezzion entity) { super.create(entity); }
  • 19. Tenet 3 Design Programming Languages for Humans 19
  • 20. Counter Example – o:XML Created By Martin Klang in 2002 Object Oriented Language Features: Poymorphism Function Overloading Exception Handling Threads 20 Diagram from: http://www.o-xml.org/documentation/o-xml-tool-chain.html
  • 21. String Replacement in o:XML vs. Java <?xml-stylesheethref="../xsl/default.xsl" type="text/xsl"?> <program> <o:function name="ex:replace"> <o:param name="input" type="String"/> <o:param name="from" type="String"/> <o:param name="to" type="String"/> <o:do> <o:variable name="result"/> <o:while test="contains($input, $from)"> <o:set result="concat($result, substring-before($input, $from), $to)"/> <o:set input="substring-after($input, $from)"/> </o:while> <o:return select="concat($result, $input)"/> </o:do> </o:function> </program> class Replace { public String replace(String input, String from, String to) { StringBuilder result = new StringBuilder(); int last = 0; int index = 0; while ((index = input.indexOf(from, last)) != -1) { result.append(input.substring(last, index)); result.append(to); last = index + from.length() } result.append(input.substring(last)); return result.toString(); } } 21 16 Lines 461 Characters 14 Lines 319 Characters
  • 22. String Replacement in o:XML <?xml-stylesheethref="../xsl/default.xsl" type="text/xsl"?> <program> <o:function name="ex:replace"> <o:param name="input" type="String"/> <o:param name="from" type="String"/> <o:param name="to" type="String"/> <o:do> <o:variable name="result"/> <o:while test="contains($input, $from)"> <o:set result="concat($result, substring-before($input, $from), $to)"/> <o:set input="substring-after($input, $from)"/> </o:while> <o:return select="concat($result, $input)"/> </o:do> </o:function> </program> 22
  • 23. Equivalent Java class Replace { public String replace(String input, String from, String to) { StringBuilder result = new StringBuilder(); int last = 0; int index = 0; while ((index = input.indexOf(from, last)) != -1) { result.append(input.substring(last, index)); result.append(to); last = index + from.length() } result.append(input.substring(last)); return result.toString(); } } 23
  • 24. Simple Java class Replace { public String replace(String input, String from, String to) { return input.replaceAll(from, to) } } 24
  • 25. JavaFX 2.0 Powerful graphics, animation, and media capabilities Deploys in the browser or on desktop Includes builders for declarative construction Alternative languages can also be used for simpler UI creation GroovyFX ScalaFX Visage 25
  • 26. 26 Hello JavaOne (Java Version) public class HelloJavaOne extends Application { public static void main(String[] args) { launch(HelloJavaOne.class, args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello JavaOne"); Group root = new Group(); Scene scene = new Scene(root, 400, 250, Color.ALICEBLUE); Text text = new Text(); text.setX(105); text.setY(120); text.setFont(new Font(30)); text.setText("Hello JavaOne"); root.getChildren().add(text); primaryStage.setScene(scene); primaryStage.show(); } }
  • 27. 27 Hello JavaOne(Builder Version) public void start(Stage primaryStage) { primaryStage.setTitle("Hello JavaOne"); primaryStage.setScene(SceneBuilder.create() .width(400) .height(250) .fill(Color.ALICEBLUE) .root( GroupBuilder.create().children( TextBuilder.create() .x(105) .y(120) .text("Hello JavaOne") .font(new Font(30)) .build() ).build() ) .build()); primaryStage.show(); }
  • 28. 28 Hello JavaOne (GroovyFX Version) GroovyFX.start { primaryStage -> defsg = new SceneGraphBuilder() sg.stage( title: 'Hello JavaOne', show: true) { scene( fill: aliceblue, width: 400, height: 250) { text( x: 105, y: 120, text: "Hello JavaOne" font: "30pt") } } }
  • 29. 29 Hello JavaOne (ScalaFX Version) object HelloJavaOne extends JFXApp { stage = new Stage { title = "Hello JavaFX" width = 400 height = 250 scene = new Scene { fill = BLUE Text { x = 105 y = 120 text = "Hello JavaOne" font = Font(size: 30) } } } }
  • 30. 30 Hello JavaOne (Visage Version) Stage { title: "Hello JavaOne" width: 400 height: 250 scene: Scene { fill: BLUE content: Text { x: 105 y: 120 text: "Hello JavaOne" font: Font {size: 30pt} } } }
  • 31. JavaOne Speakers Application End-to-end application with no XML coding Server written using JavaEE 6 annotations Data transfer uses JSON Client written in JavaFX 2.0 31
  • 33. Support the Freedom From XML Petition http://steveonjava.com/freedom-from-xml/ Provide Non-XML Alternatives For: Declarative Programming Configuration Data Transfer 33 </> Sign the Petition Today!
  • 34. 34 Stephen Chin steveonjava@gmail.com tweet: @steveonjava Arun Gupta arun.p.gupta@oracle.com tweet: @arungupta