Sunday, September 29, 2013

javaOne 2013 Overview

1. Introduction to Java 8 and JVM
  • Project Nashorn implemented 
    • Implementing a light-weight high performance JavaScript runtime in Java with JVM
    • Enables embedding of javascript in java applications.
  • Transition in  technologies
    • Thick(Rich) client platforms
      • AWT -> Swing -> JavaFX
    • Rich Internet application(RIA) platforms
      • Servlets -> JSP -> JSF -> REST -> Web Sockets
    • Integration platforms
      • RMI -> CORBA -> SOAP -> JAXB
  • JavaFX
    • Lightweight and hardware accelerated Java UI platform
    • Components 
      • FXML: A XML based declarative markup language.
      • Controller
      • CSS
    • Code Binding
      • Method 1 : Input and output fields have unique Ids. On input in UI, it creates an instance of Controller and uses DI to link front inputs to controller variables through FXId
      • Method 2: Using javaScript on JVM, input field triggers an action in javaScript.
      • Method 3 :  Dynamic Binding(Listeners); binding is done through hashMethods(#animate, where animate() is in controller)
  • Java 8: Lambda Programming
    • Refer here

2. GlassFish Community : GlassFish 4.0
  • Java EE 7 support
  • JSR 353: Java API for JSON processing 
  • JSR 356: Java API for WebSocket
  • JSR 236: Concurrency Utilities
  • JSR 343: Java Message Service 2.0 (Simplified)
  • JSR 352: Batch applications support with a runtime for both scheduling and executing batch jobs
  • Annotated POJOs, less boilerplate code
  • Cohesive integrated platform
  • Servlet 3.1 NIO
  • FacesBean are riding towards deprecation, CDI beans are the standard. 
3. Keynote

  • Watch Keynote here..
  • JDK 8 download here..
    • Lambda programming
      • Parallelism in real sense
      • Less boilerplate code
      • Streams
      • Makes code more readable, easily writable, less error prone and compact
    • Date & Time API
    • Security updates
    • Project Nashorn
  • NetBeans 7.4 RC1
    • Debug javaScript on the fly
    • Emulators for actual device test
    • Support for iOS and Android development
  • Java ME 8 and Raspberry pi
    • Meet DukePad: DIY, Raspberry pi, Java ME 8 and JavaFX (DukePad wiki)
    •  
  • Beyond SE 8
    • Project Sumatra: Enables Java use on GPUs and APUs
    • Project Avatar Avatar here..
4. JEE 7 with PrimeFaces
  • Martin Fousek was awesome !!
  • JSF 2.2
    • HTML 5 support
      • New namespaces
      • JSF/JavaScript components
      • Control over rendered facelets
    • Resource Libraries Contracts
      • Each contract is a collection of templates, js, css and other resources
      • URL based definition within faces-config
      • static/dynamic view definition
      • Multi-templating
    • Developer productivity
    • Meets enterprise demands
    • Faces Flow
  • PrimeFaces
    • Open source component library
    • Zero configuration
    • Extensive theming and mobile components
    • Well documented
    • Active community support
  • Expression Language 3.0
    • Easy communication between presentation layer and application logic
    • Deferred or immediate evaluation of expressions
    • Easy method invocation
    • Standalone ELProcessor
    • Contcatenation, semicolon and assignment operators
    • Static collections,  Collection operations
    • Lambda Expressions
  • PrimeTime with PrimeFaces
    • Built-in Ajax with JSF 2.0 Ajax APIs
    • Client APIs on jQuery
    • Enterprise theming with Theme Roller(4.0 Sentinel)
      • Client side validation
      • Dialog framework
      • Tree Drag and drop
      • Deferred loading and more
  • JSF Scaffolding with PrimeFaces
    • Generation of CRUD skeleton fron database
    • database -> entity classes -> JSF pages 
      • NetBeans can generate JSPs or vanilla facelets
      • nbpfcrudgen plugin can generate Facelets with PrimeFaces
  • FacesFlow(@FlowScoped)
    • Reusable collection of screens with defined entry and exit points
    • CDI injected.
    • Java definition using flow builder(@FlowDefinition)
  • Annotation based component registration
    • Improved faces component interface
    • Eliminates needs for TLD file
    • @FacesComponent
  • File upload 
    • Servlet 3.0 multiple architecture
    • Standard component with/without AJAX requests
  • NetBeans IDE support
  • Sample code on GitHub(Code here)
5. JSF 2.2
  • New features 
  • Stateless JSF
    • States
      • UI component state: model and view state.
      • Persistence tier state: persistence solution
      • Model tier state: controller state.
    • Specification changes in Restore view phase.
    • Stateless views
      • Memory and performance advantages.
      • Ability to route request to any node in cluster.
      • Preventing view expired exceptions.
  • Resources
    • ResourceResolver has been merged with ResourceHandler and ResourceResolver is deprecated.
    • Resource Library resources : "contracts" directory(resource directory) containing templates, insertion points in templates, resources (css, js etc)
  • Faces Flow
    • Modularity behaviour to jsf.
    •  It has a special location in class path (META-INF/flow).
    • Application sub-module
    • Well defined entry and exit
    • I/O parameters
    • Flow scope
    • Pre and post handlers
    • ADF task flows 
      • Bounded task flows:
        A set of activities, control flow rules and managed beans that interact to allow a user to complete a task.
      • Unbounded task flows:
        It has a single entry point and zero or more exit points. It contains its own set of private control flow rules, activities, and managed beans
    • Spring web flow
    • Flow handler supports 5 new node types(7 types, 5 new) : method types that can be called from facelet
      • View nodes
      • Method call nodes
      • Switch nodes
      • Flow call nodes : redirection from methods to new flow
      • Return nodes: return methods
  • Pass-through attributes
    • From a Facelet, pass-through attributes can be set in 3 ways:
      • Via a Name-spaced attribute on the component tag
      • TagHandler f:passThroughAttribute that sets a single attribute
      • TagHandler f:passThroughAttributes that sets multiple attributes
  • Security/Type-safety
    • CSRF protection: client state encryption.
    • Type checking for composite component attribute
  • @FlowScoped: A CDI scope that causes the runtime to consider classes with this annotation to be in the scope of the specified flow; A flow scoped bean is thus a bean that can be used to back a flow instead of just a single view (page)
  • CDI compatible @ViewScoped
  • Facelets Component tag declared via annotation(@ FacesComponent).
6. Programming with Lambda 
  • Benefits
    • Code clarity
    • Less errors
    • Parallelisation
  • Iterations
    • External iterators -> Internal iterators
    • Imperative style -> Functional style
  • Composing with lambda expressions
    • Imperative codes are mutable
    • TRIE data structure: good data structure for building memory efficient dictionary with ast lookup.
    • Declarative/Functional style using lambdas 
  • Sample code to double first even number after 3 using lambdas in java in composed method pattern
    • System.out::println(numbers.stream() // Stream operations are lazy
                        .filter(ClassName::isGreaterThan3) // all are inline private methods
                        .filter(ClassName::isEven)  // filters are subsets of input
                        .map(ClassName::doubleInt)
                        .findfirst()); 
  • Streams in Top gear
    • Stream 
      • An abstraction for aggregate computations on a data set. 
      • It is not a data structure.
      • It can be of infinite length
      • Fusing, laziness and parallelism supported
      • Filter and map are Lazy operations
      • Terminal operations execute the stream pipeline
      • Stream pipeline behave like builders
      • Code re-use is leveraged by using streams
      • Sum, min, max, count are cases of reduction operation
      • Reduces elements to a single summary value using a  combining function
      • Reduction is mutable
      • Sample => filter().map().sum()
        filter and map don't actually do any operation, they just set intermediately operations in stream pipeline
    • Stream source 
      • Collection.stream(), Collection.parallelStream()
      • Arrays.stream()
      • Spliterators(Spliterator.class)
      • Arrays and IntStream have best decomposability
    • Parallel Streams
      • Deterministic
      • Better use of multiple cores
      • Parallel pipeline is composite of many sequential pipelines
      • More work, less time 
      • Concurrent invocation
      • Built on fork-join tasks 
      • Performance: not always faster 

No comments :

Post a Comment