SlideShare una empresa de Scribd logo
1 de 32
   Sébastien Prunier
    › Architecte JEE chez Ovialis
    › Adepte des JUGs
    › Certifié Bonita OS


 @sebprunier
 gplus.to/sebprunier
 Java User Blog !
    › sebprunier.wordpress.com
   Relations avec des partenaires
    technologiques
 19h – 21h (max)
 Pot offert par Ovialis




          http://www.xebia.fr/xebia-essentials
   Ce soir nous allons donc parler de Java !
   Refactoring de code




                     Source : http://www.energizedwork.com
   Sortie officielle de Java SE 7
   JSR 334 – Project Coin
    › Evolutions du langage
   JSR 292 – InvokeDynamic
    › Support pour les langage dynamiques
   JSR 166 – Fork / Join
    › Programmation parallèle
   JSR 203 – NIO.2
    › Nouvelles APIs
   Et d’autres petites nouveautés sympa !
 Binary Literals
 Underscores in Numeric Literals
 String in switch Statements
 Multiple Catch and More Precise Rethrow
 Type Inference for Generics Instanciation
 Try-with-resource Statement
 Simplified Varargs Method Invocation
   Avant
    // 213
    int binarynumber = Integer.parseInt("11010101", 2);



   Après
    // 213
    int binarynumber = 0b11010101;
   Avant
    int bignumber = 45321589;




   Après
    int bignumber = 45_321_589;


    // 213
    int binarynumber = 0b1101_0101;
   Qui n’a pas essayé cela avant Java 7 ?
    String command = args[0];

    switch (command) {
        case "start":
            MyApplication.start();
            break;
        case "stop":
            MyApplication.stop();
            break;
        default:
            // Manage error
            break;
    }
   Objectif : factoriser !
    try {
        // Database access stuff ...
    }
    catch (ClassNotFoundException | SQLException e) {
        System.err.println("Error during database
            access : " + e.getMessage());
    }
    catch (Exception e) {
        System.err.println("Unexpected error !"
            + "Please contact the technical support");
    }
   Avant
    private void manageData()
        throws SQLException, IOException {
        // Database access, File access ...
    }

    public void myAction() throws Exception {
        try {
            manageData();
         } catch (Exception e) {
            // your stuff here !
            throw e;
        }
    }
   Après
    private void manageData()
        throws SQLException, IOException {
        // Database access, File access ...
    }

    public void myAction() throws
    SQLException, IOException {
        try {
            manageData();
         } catch (Exception e) {
            // your stuff here !
            throw e;
        }
    }
   Avant
    List<String> list = new ArrayList<String>();

    Map<String, Integer> map = new HashMap<String, Integer>();

    Map<String, List<BigDecimal>> map2 = new HashMap<String, Lis
   Après
    List<String> list = new ArrayList<>();

    Map<String, Integer> map = new HashMap<>();

    Map<String, List<BigDecimal>> map2 = new HashMap<>();
 ZE nouveauté !
 Un réel intérêt : éviter des bugs bêtes

    try (BufferedReader reader = new BufferedReader(…)) {
        String line = reader.readLine();
        while (line != null) {
            System.out.println(line);
            line = reader.readLine();
        }
    } catch (IOException e) {
        System.err.println("Erreur : " + e.getMessage());
    }


              finally{…}          close()
   java.lang.AutoCloseable

    public class MyResource implements AutoCloseable {

        ...

        @Override
        public void close() throws Exception {
            // Your stuff here !
        }
    }
   @SafeVarargs

    @SafeVarargs
    public static <T> void addToList(List<T> listArg,
                                     T... elements) {
        for (T x : elements) {
            listArg.add(x);
        }
    }




     Type safety: Potential heap pollution via varargs parameter elements
 java.util.Objects
 9 méthodes utilitaires sur les « Object »
 Un vrai + pour du code plus simple, plus
  lisible

   Deux exemple dans la démo :
    › Objects.toString()
    › Objects.hash()
> javadoc -stylesheetfile MyStylesheet.css
   Exemple de la copie de fichiers
    › java.nio.file.*

FileSystem fs = FileSystems.getDefault();
Path src = fs.getPath("/home", "source.txt");
Path tgt = fs.getPath("/backup", "target.txt");

Files.copy(src, tgt, StandardCopyOption.REPLACE_EXISTING);
   Un peu de lecture si vous le souhaitez …

http://groups.google.com/group/lescastcodeurs/msg/90ddf025c52a9412
 Tirer parti des processeurs multiples
 API de programmation parallèle
 Voir aussi
    › Map / Reduce
    › Hadoop
    › GridGain
   Approche très simple

if (my portion of the work is small enough)
    do the work directly
else
    split my work into two pieces
    invoke the two pieces and wait for the results



   Démo !


http://download.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html
   Collection Literals
     › Initialement dans Coin

 List<Integer> piDigits = [3, 1, 4, 1, 6, 5, 3, 5, 9];


 Set<Integer> primes = { 2, 7, 31, 127, 8191, 131071};


 Map<Integer, String> platonicSolids =
 { 4 : "tetrahedron", 6 : "cube", 8 : "octahedron", 12 :
 "dodecahedron", 20 : "icosahedron" };



http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001193.html
   JSR 335 – Lamba Expressions
     › Closures
     › Fonctions anonymes

        x -> x + 1
        (x) -> x + 1
        (int x) -> x + 1
        (int x, int y) -> x + y
        (x, y) -> x + y




http://mail.openjdk.java.net/pipermail/lambda-dev/2011-September/003936.html
   Modularité : Projet JIGSAW


module-info.java
module com.greetings @ 0.1 {
  requires jdk.base; // default to the highest available
  version requires org.astro @ 1.2;
  class com.greetings.Hello;
}




            http://openjdk.java.net/projects/jigsaw/
   Java 7 : Hands-On !
    › Démo sur GitHub
    › https://github.com/sebprunier/nantesjug-java7

   Java 8 : Watch !
    › Sortie prévue été 2013

   Java 9 …
   Questions / Réponses

Más contenido relacionado

La actualidad más candente

Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]Baruch Sadogursky
 
async/await Revisited
async/await Revisitedasync/await Revisited
async/await RevisitedRiza Fahmi
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programingwahyuseptiansyah
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Riza Fahmi
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...julien.ponge
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptIngvar Stepanyan
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка TwistedMaxim Kulsha
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidJordi Gerona
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6Fiyaz Hasan
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistAnton Arhipov
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Charles Nutter
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 

La actualidad más candente (20)

Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
Server1
Server1Server1
Server1
 
async/await Revisited
async/await Revisitedasync/await Revisited
async/await Revisited
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
 
Обзор фреймворка Twisted
Обзор фреймворка TwistedОбзор фреймворка Twisted
Обзор фреймворка Twisted
 
Google Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & AndroidGoogle Guava - Core libraries for Java & Android
Google Guava - Core libraries for Java & Android
 
What’s new in C# 6
What’s new in C# 6What’s new in C# 6
What’s new in C# 6
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with Javassist
 
Java
JavaJava
Java
 
devday2012
devday2012devday2012
devday2012
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 

Similar a Nantes Jug - Java 7

From Java 6 to Java 7 reference
From Java 6 to Java 7 referenceFrom Java 6 to Java 7 reference
From Java 6 to Java 7 referenceGiacomo Veneri
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVMRafael Winterhalter
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Mail.ru Group
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Mail.ru Group
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx FranceDavid Delabassee
 
JS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js AntipatternsJS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js AntipatternsTimur Shemsedinov
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVMVaclav Pech
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
About java
About javaAbout java
About javaJay Xu
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy PluginsPaul King
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Datagreenwop
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 

Similar a Nantes Jug - Java 7 (20)

From Java 6 to Java 7 reference
From Java 6 to Java 7 referenceFrom Java 6 to Java 7 reference
From Java 6 to Java 7 reference
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
What`s new in Java 7
What`s new in Java 7What`s new in Java 7
What`s new in Java 7
 
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
Security Meetup 22 октября. «PHP Unserialize Exploiting». Павел Топорков. Лаб...
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France55 new things in Java 7 - Devoxx France
55 new things in Java 7 - Devoxx France
 
JS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js AntipatternsJS Fest 2019 Node.js Antipatterns
JS Fest 2019 Node.js Antipatterns
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
In kor we Trust
In kor we TrustIn kor we Trust
In kor we Trust
 
Concurrency on the JVM
Concurrency on the JVMConcurrency on the JVM
Concurrency on the JVM
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
About java
About javaAbout java
About java
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 

Más de Sébastien Prunier

De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...Sébastien Prunier
 
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...Sébastien Prunier
 
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?Sébastien Prunier
 
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?Sébastien Prunier
 
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...Sébastien Prunier
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !Sébastien Prunier
 
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...Sébastien Prunier
 
Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10Sébastien Prunier
 
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBJugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBSébastien Prunier
 
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...Sébastien Prunier
 
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...Sébastien Prunier
 
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...Sébastien Prunier
 

Más de Sébastien Prunier (12)

De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
De votre idée géniale à votre Minimum Viable Product - Café Techno Niort ...
 
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...De votre idée géniale à votre Minimum Viable Product - Rencontres National...
De votre idée géniale à votre Minimum Viable Product - Rencontres National...
 
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?
 
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
[Breizhcamp 2015] MongoDB et Elastic, meilleurs ennemis ?
 
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
[Breizhcamp 2015] Refactoring avec 1,22% de code couvert par les tests ... Go...
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
 
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
Refactoring avec 1,22% de code couvert par les tests ... Golden Master testin...
 
Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10Nantes JUG - Les News - 2013-10-10
Nantes JUG - Les News - 2013-10-10
 
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBJugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
 
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
Poitou Charentes JUG - Traçabilité dans une architecture distribuée avec Node...
 
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
Nantes JUG - Traçabilité dans une architecture distribuée avec Node.js et Mon...
 
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
Add BPM to your business applications with Bonita Open Solution - JugSummerCa...
 

Último

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Nantes Jug - Java 7

  • 1.
  • 2. Sébastien Prunier › Architecte JEE chez Ovialis › Adepte des JUGs › Certifié Bonita OS  @sebprunier  gplus.to/sebprunier  Java User Blog ! › sebprunier.wordpress.com
  • 3. Relations avec des partenaires technologiques
  • 4.  19h – 21h (max)  Pot offert par Ovialis http://www.xebia.fr/xebia-essentials
  • 5.
  • 6. Ce soir nous allons donc parler de Java !
  • 7. Refactoring de code Source : http://www.energizedwork.com
  • 8. Sortie officielle de Java SE 7
  • 9. JSR 334 – Project Coin › Evolutions du langage  JSR 292 – InvokeDynamic › Support pour les langage dynamiques  JSR 166 – Fork / Join › Programmation parallèle  JSR 203 – NIO.2 › Nouvelles APIs  Et d’autres petites nouveautés sympa !
  • 10.  Binary Literals  Underscores in Numeric Literals  String in switch Statements  Multiple Catch and More Precise Rethrow  Type Inference for Generics Instanciation  Try-with-resource Statement  Simplified Varargs Method Invocation
  • 11. Avant // 213 int binarynumber = Integer.parseInt("11010101", 2);  Après // 213 int binarynumber = 0b11010101;
  • 12. Avant int bignumber = 45321589;  Après int bignumber = 45_321_589; // 213 int binarynumber = 0b1101_0101;
  • 13. Qui n’a pas essayé cela avant Java 7 ? String command = args[0]; switch (command) { case "start": MyApplication.start(); break; case "stop": MyApplication.stop(); break; default: // Manage error break; }
  • 14. Objectif : factoriser ! try { // Database access stuff ... } catch (ClassNotFoundException | SQLException e) { System.err.println("Error during database access : " + e.getMessage()); } catch (Exception e) { System.err.println("Unexpected error !" + "Please contact the technical support"); }
  • 15. Avant private void manageData() throws SQLException, IOException { // Database access, File access ... } public void myAction() throws Exception { try { manageData(); } catch (Exception e) { // your stuff here ! throw e; } }
  • 16. Après private void manageData() throws SQLException, IOException { // Database access, File access ... } public void myAction() throws SQLException, IOException { try { manageData(); } catch (Exception e) { // your stuff here ! throw e; } }
  • 17. Avant List<String> list = new ArrayList<String>(); Map<String, Integer> map = new HashMap<String, Integer>(); Map<String, List<BigDecimal>> map2 = new HashMap<String, Lis
  • 18. Après List<String> list = new ArrayList<>(); Map<String, Integer> map = new HashMap<>(); Map<String, List<BigDecimal>> map2 = new HashMap<>();
  • 19.  ZE nouveauté !  Un réel intérêt : éviter des bugs bêtes try (BufferedReader reader = new BufferedReader(…)) { String line = reader.readLine(); while (line != null) { System.out.println(line); line = reader.readLine(); } } catch (IOException e) { System.err.println("Erreur : " + e.getMessage()); } finally{…} close()
  • 20. java.lang.AutoCloseable public class MyResource implements AutoCloseable { ... @Override public void close() throws Exception { // Your stuff here ! } }
  • 21. @SafeVarargs @SafeVarargs public static <T> void addToList(List<T> listArg, T... elements) { for (T x : elements) { listArg.add(x); } } Type safety: Potential heap pollution via varargs parameter elements
  • 22.  java.util.Objects  9 méthodes utilitaires sur les « Object »  Un vrai + pour du code plus simple, plus lisible  Deux exemple dans la démo : › Objects.toString() › Objects.hash()
  • 23. > javadoc -stylesheetfile MyStylesheet.css
  • 24. Exemple de la copie de fichiers › java.nio.file.* FileSystem fs = FileSystems.getDefault(); Path src = fs.getPath("/home", "source.txt"); Path tgt = fs.getPath("/backup", "target.txt"); Files.copy(src, tgt, StandardCopyOption.REPLACE_EXISTING);
  • 25. Un peu de lecture si vous le souhaitez … http://groups.google.com/group/lescastcodeurs/msg/90ddf025c52a9412
  • 26.  Tirer parti des processeurs multiples  API de programmation parallèle  Voir aussi › Map / Reduce › Hadoop › GridGain
  • 27. Approche très simple if (my portion of the work is small enough) do the work directly else split my work into two pieces invoke the two pieces and wait for the results  Démo ! http://download.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html
  • 28. Collection Literals › Initialement dans Coin List<Integer> piDigits = [3, 1, 4, 1, 6, 5, 3, 5, 9]; Set<Integer> primes = { 2, 7, 31, 127, 8191, 131071}; Map<Integer, String> platonicSolids = { 4 : "tetrahedron", 6 : "cube", 8 : "octahedron", 12 : "dodecahedron", 20 : "icosahedron" }; http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001193.html
  • 29. JSR 335 – Lamba Expressions › Closures › Fonctions anonymes x -> x + 1 (x) -> x + 1 (int x) -> x + 1 (int x, int y) -> x + y (x, y) -> x + y http://mail.openjdk.java.net/pipermail/lambda-dev/2011-September/003936.html
  • 30. Modularité : Projet JIGSAW module-info.java module com.greetings @ 0.1 { requires jdk.base; // default to the highest available version requires org.astro @ 1.2; class com.greetings.Hello; } http://openjdk.java.net/projects/jigsaw/
  • 31. Java 7 : Hands-On ! › Démo sur GitHub › https://github.com/sebprunier/nantesjug-java7  Java 8 : Watch ! › Sortie prévue été 2013  Java 9 …
  • 32. Questions / Réponses