Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Jet presentation

593 views

Published on

Java Emerging Technology overviegiven to Solnet team after attending the event.

Published in: Technology
  • Be the first to like this

Jet presentation

  1. 1. Solnet Solutions LtdJET (Java Emerging Technology) Conference – September 2008
  2. 2. JET (Java Emerging Technology) Conference http://java.meetup.com/162 Conference Details Organised by the Auckland Java Group http://jet.javacom.co.nz Outline of the sessions attended Java 7, EasyB, Scala, Groovy, Grails, J2ME and Android Future Presentations on sessions attended…
  3. 3. Java 7 What is likely to be in included in Java 7? What impacts us? Do we care? JSR 294 – Super Packages JSR 297 – Java Module System (JAMS) JSR 310 – Date and Time JSR 210 – New NIO JSR 295 – Beans Binding JSR 303 – Bean Validation JSR 292 – Invoke Dynamic
  4. 4. Java 7 Other includes… JSR 166 – Concurrency JSR 296 – Swing JSR 225 – XQuery API JSR 255 – JMX 2.0 JSR 262 – Web Services Connector for JMX …but not likely to be included…
  5. 5. Java 7 Not likely to be included in Java 7 Closures JavaDoc Update Refined Generics Property Support List of all JSR’s - http://jcp.org/en/jsr/all
  6. 6. EasyB BDD (Behaviour Driven Development) Specifications based DSL written in Groovy ‘Test’ replaced with ‘Should’ Uses an easy-to-understand structure – Given [a context]… – When [something happens]… – Then [something else happens]…
  7. 7. EasyB EasyB example code: scenario “Make initial deposit onto a new account” given “a new account”, { account = new Account() } when “an initial deposit is made”, { initialAmount = 100 account.makeDeposit(initialAmount) } then “the balance should be equal to the amount deposited”, { account.balance.shouldBe initialAmount } http://easyb.org – EasyB website http://weblogs.java.net/blog/johnsmart/archive/2008/09/a - John Smart’s Presentation Java Power Tools – O’Reilly
  8. 8. Scala Object Orientated Functional Language Runs on the JVM Release candidate status (2.7.2 RC2 – 19/09) Types and behaviours are described by classes and traits Has implicit type inference, closures and powerful pattern matching …lets take a look at some code…
  9. 9. Scala Love Game – Java Code// Creates 2 character arrays that will be comparedchar bothNamesArray[] = “roger federer maria sharapova”.toCharArray();char compWordArray[] = “loves”.toCharArray();// Creates an Integer array for storing count resultsInteger tallyArray[] = new Integer[compWord.length()];int tallyArrayPointer = 0;int matchCounter = 0;/* * Counts the number of times each character in compWordArray also * appears in bothNamesArray */While (tallyArrayPointer < compWord.length()) { for (int i = 0; i < bothNames.length(); i++) { ... ..enough of that…let’s do this with Scala…
  10. 10. Scala Love Game – Scala Codeval names = “roger federer maria sharapova”val initialList = “loves”.toList map( x => names.toList count(x == _))def loveReduce(numbers:List[Int]):Int = numbers match { case head::Nil => head * 2 case _ => loveReduce(numbers zip(numbers tail) map { case (a,b) => a + b})}// Displays the compatability percentageprintln(“Compatibility = “ + loveReduce(initialList) + “ %”) …much better? Notes about the example: Syntax – no semi-colons, optional parentheses Pattern matching, List operations
  11. 11. Scala Scala Resources http://www.scala-lang.org http://stubbisms.wordpress.com/2008/02/22/my-foray-in - Love Game Example http://www.codecommit.com/blog/scala/roundup-scala-f Series on IBM Developerworks – Scala for the busy Java Developers
  12. 12. Groovy Dynamic Language Runs in the JVM Shell Interpreter Supports DSL (EasyB) Seamlessly integrates with all existing Java objects and libraries Useful for scripting builds (integration with Maven and Ant) Useful for quick prototypes
  13. 13. Groovy So why learn Groovy…. JDBC Example – Java Codeimport java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class JDBCExample { public static void main(String[] args) { Connection con = null; ... try { // Connection code` } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { ... …enough..my fingers are hurting..let’s get Groovy…
  14. 14. Groovy JDBC Example – Groovy Codeimport groovy.sql.Sqlclass GroovySqlExample { static void main(args) { sql = Sql.newInstance(“jdbc:mysql://localhost:3306/words”, “words”, “words”, “org.gjt.mm.mysql.Driver”) sql.eachRow(“select * from word”) { row -> println row.word_id + “ “ + row.spelling + “ “ + row.part_of_speech } }} Notes on the example code eachRow method – iterator of the passed in query Closure used for each result row Groovlet and Groovy Templates
  15. 15. Groovy Want to learn more about Groovy? http://groovy.codehaus.org Practically Groovy series on IBM Developerworks (some of the examples in earlier parts are outdated) Slides from the presentation at JET conference will be available online soon
  16. 16. Grails Web application framework leveraging Groovy Aims to simplify development “coding by convention” – file system, file names and such carry meaning (replace XML configuration files) Leverages Hibernate and Spring Quick and simple to set up and deploy an application Excellent documentation compared to Groovy http://grails.org
  17. 17. J2ME Latest developments in J2ME development UI Developments LWUIT (LightWeight User Interface Toolkit) - Swing like capabilities - IDE Demo had screen refresh issues Flex Mobile Technical Development Application Signing (allows access to comms and database) Difficulties with BlackBerry Development
  18. 18. Android Google Android mobile platform using the Java programming language Access to core mobile device functionality Easily embed the web with WebView SDK – Eclipse IDE (Simulator) Demo application – Issues with screen refresh as per J2ME LWUIT Android Developer challenge http://code.google.com/android

×