Java 7- Java Day Guatemala
-
Upload
victor-orozco -
Category
Technology
-
view
841 -
download
3
description
Transcript of Java 7- Java Day Guatemala
- 1. Java 7 El futuro de Java Vctor Leonel Orozco ( Java SE 7: The Platform Evolves ) Guatejug http://tuxtor.shekalug.org
2. Licencia
- This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Guatemala License.
3. doEvolution(Java. . . versiones) 4. Java 5. OpenJDK
- JDK7 el segundo de su especie
6. GPL 7. Comunidad OpenJDK -> JDK 7 8. Base para JSR 9. OpenJDK la plataforma para saltarse JCP y luego entrar a JCP 10. Un largo camino
- Actualizar la especificacin
11. Implementar el compilador 12. Desarrollar nuevas bibliotecas 13. Pruebas 14. Actualizar especificaciones JVM 15. Planear la siguiente evolucin 16. Actualizar las herramientas de la JVM
- Actualizar JNI
17. Actualizar java reflect API 18. Actualizar serializacion 19. Verificar compatibilidad 20. Cambios en JDK 7
- Lenguaje (Coin JSR-334)
21. Lamda, Modularity (8) 22. DaVinci->Invokedynamic (hi jython you're wellcome!) 23. NIO 2, Fork/Join(JSR-166y) 24. Otros (JSR-336) 25. Coin 26. Coin
- Pequeos cambios de lenguaje
- No hay nuevas palabras reservadas
Coordinacin con lamda y modularity (8) 27. La necesidad de evolucin
- Principios Java
- Lecturaes ms importante que escritura
28. El codigo debe ser agradable a lalectura 29. El lenguaje no debe esconder lo que esta pasando 30. El codigo debe ejecutar lo que aparenta ejecutar 31. La simplicidad importa Evolving the Java Language - JavaOne 2005 32.
- Nuevas caracteristicas en numeros
- Binary literals
- Underrscores
- int mask = 0b101010101010;
- int mask = 0b1010 _ 1010 _ 1010; long big = 9 _ 223 _ 783 _ 036 _ 967 _ 937L;
33.
- Switch+string (por fin!!!)
- Hasta el momento una sentencia switch-case solo funciona con int o enum
34. Sin embargo no hay motivo para que no funcione con Strings, son un tipo especial de objetos incomutables 35.
- Strings hoy
if(fooString.equalsIgnoreCase("hola")){ System.out.println("hola amigos"); }else if(fooString.equalsIgnoreCase("guatejug")){ System.out.println("guatejug"); }.... }else{ System.out.println("d(_)"); } 36.
- Strings HOY
switch (fooString) { case "hola": System.out.println("hola amigos"); break; case "guatejug": System.out.println("guatejug"); break; default: System.out.println("d(_)"); break; } 37.
- Generics
Sin Generics
- List strList = new ArrayList();
38.
- Generics
Sin Generics
- List strList = new ArrayList();
Generics hoy List strList = new ArrayList (); 39.
- Generics
Sin Generics
- List strList = new ArrayList();
Generics hoy List strList = new ArrayList (); Generics hoy List < Map >strList =
- new ArrayList < Map > ();
40. Generics HOY (diamond)
- List strList = new ArrayList (); List < Map >strList = new ArrayList ();
- Generics
41. BufferedReader br; try{ br = new BufferedReader( new FileReader("./prueba.txt")); String line; while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); } catch (final IOException e) { System.out.println(e.toString()); } finally{ }
- Administracin recursos
42. BufferedReader br; try{ br = new BufferedReader( new FileReader("./prueba.txt")); String line; while ((line = br.readLine()) != null) { System.out.println(line);//Puede fallar aca } br.close(); //Y ya no llegar aca System.out.println(":("); } catch (final IOException e) { System.out.println(e.toString()); } finally{ }
- Administracin recursos
43. try (final BufferedReader br = new BufferedReader(new FileReader("./prueba.txt"))){ String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (final IOException e) { System.out.println(e.toString()); }
- Administracin recursos
44. try { if (a == 0) { throw new ExcepcionA(); } if (a > 0) { throw new ExcepcionB(); } } catch (ExcepcionA ex) { System.out.println(ex.getClass() + " fue lanzada"); } catch (ExcepcionB ex) { System.out.println(ex.getClass() + " fue lanzada"); }
- Multi-catch
45. try { if (a == 0) { throw new ExcepcionA(); } if (a > 0) { throw new ExcepcionB(); } } catch ( ExcepcionA|ExcepcionB ex ) { System.out.println(ex.getClass() +" fue lanzada"); }
- Multi-catch
46. Ms
- Heap pollution
47. Mejores advertencias al utilizar vararg (String. . . foo) 48. Mejores backtraces 49. DaVinci->Invokedynamic 50. JVM una obra de ingeniera JVM proporciona
-
- Administracin de memoria
- 51. Control de concurrencia
52. Seguridad 53. Bibliotecas estandar 54. Entorno de ejecucin premium (rapido y furioso) 55. Sesiones de debug 56. La magia del bytecode
- Segn las especificaciones de creacin de maquinas virtuales la maquina virtual NO RECONOCE NADA acerca de Java, toda su ejecucin la hace a travs de bytecode. Java fue solo el principio la comunidad hizo el resto
57. Alguien dijo .net? 58.
- Lenguajes
- Clojure
- Tcl
- JavaScript
- v-language
- CAL
- Sather
- Funnel
- Mini
- PLAN
- Lisp
- Scheme
- Basic
- Logo
- JHCR
- TermWare
- Drools
- Prolog
- LLP
- JESS
- Eiffel
- Smalltalk
- C#
- G
- Groovy
- Nice
- Anvil
- Hojo
- Correlate
- Ada
- Bex Script
- Tea
- PHP
- Phobos
- Sleep
- FScript
- JudoScript
- JRuby
- ObjectScript
- Jickle
- Yoix
- Simkin
- BeanShell
- Dawn
- WebL
- iScript
- Jython
- Pnuts
- Yassl
- Forth
- Piccola
- SALSA
- Processing
- Zigzag
- Tiger
- Tiger
- Icon
- Pascal
- Oberon
- Modula-2
- Luck
- E
- Rexx
- JavaFX Script
- Scala
59.
- InvokeDynamic
- JVM pensada en Java
60. Cuatro formas de invocar codigo
-
- Invokevirtual, invokeinterface, invokestatic, invokespecial
- Todas necesitan firma (nombre+parametros)
61. http://openjdk.java.net/projects/mlvm/ 62. JSR-292 63. JSR 223: Scripting for the Java Platform JDK 6 64.
- Nueva forma de invocacin de funcionalidades a travs de un administrador de metodos
65. La llamada InvokeDynamic genera un administrador del metodo 66. Fase 0 Bootstrap, se genera la referencia al metodo de manera dinmica (primera invocacin) 67. Las siguientes llamadas utilizaran esta referencia
- InvokeDynamic
68.
- InvokeDynamic
- this[method_name](x, y)
- invokedynamic [#bootstrapMethod] .this_method_name
- class LangaugeRuntime { bootstrapMethod(info) { ... return new CallSite(); }
- class AClass { aMethod(x, y) { ... }
- CallSite
- Method Handle
- 1. Bootstrap
- 2.Se genera puntero
- 3.Enlace dinamico
- 4. Invoca implementacion del metodo
69. Bibliotecas 70.
- GUI
- Nimbus Look and Feel
71. Interaccin con las API's de transparencia 72. JLayer 73. Nuevas mejoras en rendimiento para renderizado 2D (Swing) 74.
- Nimbus Look and Feel
- Los dias de metal estan contados
75. Java SE 6u10, ahora Swing 76.
- JLayer
77. NIO2-JSR 203 La reinvencin de las bibliotecas I/O
-
- No fueron diseadas para ser extensibles
- 78. Las excepciones tiene problemas y no funcionan como se espera
79. rename()funciona parcialmente 80. Los desarrolladores necesitan acceso a ms datos sin utilizar JNI NIO2 al rescate 81. NIO2 :)
- Path vrs. File
- File era una clase muy *nix
Mejor soporte a directorios
- list() ahora se comporta como stream via iterator
Soporte de symlinks (hell yeah! ) 82. java.nio.file.Filesystem
- Interfaz a sistemas de archivos (FAT, ZFS, Zip archive, red)
java.nio.file.attribute
- Metadata
83.
- Path
- Inmutable
84. Nuevos metodos paraPath 85. Unicamente se puede crear porPath y FileSystem
- //Genero la referencia Path home = Paths.get( /home/fred ); //Ingreso a un directorio /home/fred -> /home/fred/tmp Path tmpPath = home.resolve( tmp ); //Convirtiendo a file File file = relativePath.toFile();
86.
- Concurrencia
- JSR166y
87. Mejor conocido como en framework fork/join 88. Apis extra para el control de concurrencia 89.
- Fork Join
- Tomar ventajas de multiples procesadores
90. Solo se puede tomar ventaja si la operacion puede dividirse en varias partes
-
- fib(10) = fib(9) + fib(8)
- Si la tarea es posible ejecutar la tarea si no es posible dividir la tarea en tareas pequeas similares (fork) unir los resultados (join)
91.
- Java 8
- Coin Ms coins
- Project Lambda (JSR 335) Closures Mejor soporte a procesadores multicore
- Project Jigsaw (JSR-294) Modularizacion (nivel superior a paquetes)
92.
- Gracias
http://www.guate-jug.org http://tuxtor.shekalug.org [email_address] http://www.slideshare.com/tuxtor http://tuxtor.shekalug.org/talks