The Future of Java Development with Java 8/9

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
J2EE Architecture Overview
L1-2:CSC ©Dr. Basheer M. Nasef Lecture #1 By Dr. Basheer M. Nasef.
An architecture for webb applications, J2EE
Introduction to Java 2 Enterprise Edition About myself –Neutrinos, Cancer Research, IT Applications Today’s topic: J2EE –Context –Advantages –Components.
 Java  Python  Bigtable(Bt) is a distributed storage system for managing structured data that is designed to scale to a very large size.  Query Language.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Eclipse Web Tools Platform.
Principles of Object-Oriented Software Development The language Java.
CS2200 Software Development Lecture: Java Platform Lecturer: Adrian O’Riordan Course Webpage:
Java 2 Platform, Enterprise Edition (J2EE). Source: Computer, August 2000 J2EE and Other Java 2 Platform Editions.
© 2004 IBM Corporation BEA WebLogic Server Introduction and Training.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
Lecturer PEN PHIROM Tel : Web site: Lecturer PEN PHIROM Tel :
Advanced Java New York University School of Continuing and Professional Studies.
Web Services Mohamed Fahmy Dr. Sherif Aly Hussein.
Bayu Priyambadha, S.Kom. What is J2EE? * Open and standard based platform for developing, deploying and managing n-tier, Web-enabled, server-centric,
Programming Fundamentals 2: Background/ F II Objectives – –give a non-technical overview of Java Semester 2, Background.
Comp2513 JavaBeans, EJB and J2EE Daniel L. Silver, Ph.D.
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
1162 JDK 5.0 Features Christian Kemper Principal Architect Borland.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
Andreas Enbohm Capgemini Sverige AB Java SE 7 (Dolphin) or ”The Future is Nigh”
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Introduction to Java The Java Platform, The Java Language, JDK, Eclipse Svetlin Nakov Technical Trainer Software University
The Java Platform, The Java Language, JDK, IntelliJ
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
introductory lecture on java programming
Singleton Academy, Pune. Course syllabus Singleton Academy Pune – Course Syllabus1.
Program: What is Java ?. What is java ? References:  Java is a programming language and computing platform.
Glink for Java: applet, application and an API for integrating access to Bull, IBM, UNIX and Minitel systems with your Java based e-business applications.
J AVA T RAINING IN A HMEDABAD By TOPS Technologies 1 TOPS Technologies Java Course.
1.Education Overview JAVA EE 6 Technologies
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
J2EE Lecture 10: EJB 3.0 Overview
Sachin Malhotra Saurabh Choudhary
Suresh Ramachandran Duke Energy
Object Oriented Programming in
Plateform for Enterprise Solution: Java EE5
Java Distributed Object System
Chapter No. : 1 Introduction to Java.
Knowledge Byte In this section, you will learn about:
JDK 1.6 change summary D. MANIKANDAN.
Java 9 New features 8/11/2017 Iason Dimitrios Rodis.
Functional Programming with Java
Java EE Overview The problem Java Enterprise Edition attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications.
آشنایی با جاوا Introduction to Java
Starting JavaProgramming
ISE 390 Dynamic Web Development
Embracing Java 9 and beyond with Eclipse JDT
Java EE Overview The problem Java Enterprise Edition attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications.
Distributed System Using Java 2 Enterprise Edition (J2EE)
JavaServer Faces: The Fundamentals
(Computer fundamental Lab)
Java History, Editions, Version Features
By Rajanikanth B Overview Of Java By Rajanikanth B
F II 1. Background Objectives
Chap 1. Getting Started Objectives
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
A Brief History January 1996: first official release JDK 1.0
Presentation transcript:

The Future of Java Development with Java 8/9 Jeffrey Poore Senior Application Architect Bank of America

About Me Graduated from MIT in 1998, Bachelors in Computer Science and Engineering Software Developer in the areas of Telephony, Finance, Health Care and Utilities Most recently moved into a Senior Architect Role at Bank of America Been developing in Java for over 10 years Love Spring, Hibernate, JBoss, and IntelliJ

Overview Java 1.0 – Java SE/EE 7 – A Walk Down Memory Lane Java 8 – Lambda Expressions, Method References, Stream APIs Java 9 – Modular JDK, Jshell Q/A

Java 1.0 – Java SE/EE 7 Java 1.0 (Oak) – January 23, 1996: Classes, methods, basic java.lang libraries Alpha and Beta JDKs Abstract methods as in C++ (no abstract class) Private access was actually package private All exceptions unchecked Java Applets Hot Java

Java 1.0 – Java SE/EE 7 Java 1.1 – February 19, 1997: Inner classes JavaBeans API Java Database Connectivity (JDBC) Java Remote Method Invocation (RMI) Reflection (introspection only) Just-in-Time Compiler (JIT) [on Windows, produced by Symantec] Internationalization and Unicode

Java 1.0 – Java SE/EE 7 J2SE 1.2 (Playground, aka Java 2) – December 8, 1998: strictfp keyword (portability of floating point calculations) Swing Graphical UI JIT in the Sun JVM Java Plug-in for Web Browsers Java IDL (Corba) Collections framework

Java 1.0 – Java SE/EE 7 J2EE 1.2 – December 12, 1999: Java Servlet API JavaServer Pages (JSP) Enterprise JavaBeans API (EJB) Java Naming and Directory Interface Specification (JNDI) Java Message Service API (JMS) Java Transaction API (JTA)

Java 1.0 – Java SE/EE 7 J2SE 1.3 (Kestrel) – May 8, 2000: HotSpot JVM JNDI included in core libraries Java Platform Debugger Architecture (JPDA) – debugging framework J2EE 1.3 – September 24, 2001: Java API for XML Processing (JAXP) JavaServer Pages Standard Tag Library (JSTL) J2EE Connector Architecture – for connecting to legacy enterprise systems Java Authentication and Authorization Service (JAAS)

Java 1.0 – Java SE/EE 7 J2SE 1.4 (Merlin) – February 6, 2002: Java Community Process (JSR) assert keyword Regular Expressions (modeled after Perl) IPv6 Support Non-blocking I/O (NIO) Logging API Integrated security and cryptography extensions (JCE, JSSE, JAAS) Java Web Start Preferences API (java.util.prefs)

Java 1.0 – Java SE/EE 7 J2EE 1.4 – November 11, 2003: Web Services for J2EE Java API for XML-based RPC (JAX-RPC) JavaServer Faces (JSF) Java Authorization Service Provider Contract for Containers (JACC) Java Management Extensions (JMX) Enterprise Edition Management/Deployment APIs

Java 1.0 – Java SE/EE 7 J2SE 5.0 (Tiger) – September 30, 2004 Version number changed to “better reflect the level of maturity, stability and security of the J2SE” Generics Annotations Autoboxing Enumerations (enum keyword) Varargs Enhanced for for (String s : List<String>) { } Static Imports Concurrency Utilities

Java 1.0 – Java SE/EE 7 E J B 3 J2EE 5 – May 11, 2006: Java Architecture for XML Binding (JAXB) SOAP with Attachments API (SAAJ) Streaming API for XML (StAX) EJB 3.0 Java Persistence API (JPA) E J B 3

Java 1.0 – Java SE/EE 7 Java SE 6 (Mustang) – December 11, 2006: Mucked with the versioning again (sigh) Scripting language support Java API for XML Web Services (JAX-WS) Java Compiler API – API to allow a Java program to compile code at runtime New garbage collection algorithms Java EE 6 – December 10, 2009: Java API for RESTful Web Services (JAX-RS) Java APIs for XML Messaging (JAXM) JSP Expression Language (EL)

Java 1.0 – Java SE/EE 7 Java SE 7 (Dolphin) – July 7, 2011: Oracle buys Sun (January 27, 2010) JVM support for dynamic languages Strings in switch statement Automatic resource management in try statement try (InputStream is = openStream()) { … } Improved type inference for Generics List<String> lst = new ArrayList<>(); Binary integer literals and underscores in numeric literals 0b1111_0101_0011, 1_204_304.44 Multiple Exception Catch catch (IOException | NullPointerException e) { … } Java EE 7 – June 12, 2013: Java API for WebSocket Java API for JSON Processing

Java SE 8 – March 18, 2014 No cute nickname, sorry Features: Lambda Expressions Method References Stream APIs Annotation on Java Types / Repeating Annotations Unsigned Integer Arithmetic New Date/Time API Removed Perm Gen Java EE 8 still in JSR Process

Lambda Expressions A Lambda Expression is similar to a function pointer in C () -> System.out.println("Hello World!") // no parameters a -> a // identity function (a, b) -> a + b // multiple parameters (long id, String name) { … } // explicit typing (a, b) -> { return a + b; } // with a code block (id, defaultPrice) -> { // multiple lines Optional<Product> product = productList.stream().filter(p -> p.getId() == id).findFirst(); return product.map(p -> p.getPrice()).orElse(defaultPrice); }

Lambda Expressions Lambda Expressions are used where functional interfaces are expected interfaces that only contain one abstract method the interfaces can have default or static methods a lambda expression is a valid return value

Lambda Expressions public class Calculator { interface Operation { int execute(int a, int b); default Operation swap() { return (a, b) -> execute(b, a); } } public static int apply(int a, int b, Operation op) { return op.execute(a, b); } ... }

Lambda Expressions public static void main(String … args) { Operation addition = (a, b) -> a + b; Operation subtraction = (a, b) -> a – b; println("40 + 2 = " + Calculator.apply(40, 2, addition); // "40 + 2 = 42" println("20 – 10 = " + Calculator.apply(20, 10, subtraction); // "20 – 10 = 10" println("10 – 20 = " + Calculator.apply(20, 10, subtraction.swap()); // "10 – 20 = -10" }

Method References A method reference is similar to a lambda function Instead of providing an implementation, you provide a reference to an existing one The method referenced doesn't have to be a part of a class that implements the given interface only the signature of the method needs to match

Method References class Person { public static int compareByAge(Person a, Person b) { return a.dateOfBirth.compareTo(b.dateOfBirth); } class PersonAgeComparator implements Comparator<Person> { public int compare(Person a, Person b) { return Person.compareByAge(a, b); } } public static void main(String … args) { Person[] people = getPeople(); Arrays.sort(people, new PersonAgeComparator()); }

Method References There has to be a better way, right? There is: sort has this signature: static <T> void sort(T[] a, Comparator<? super T> c); Comparator is a functional interface, therefore a Lambda expression could be used: Arrays.sort(people, (a, b) -> return Person.compareByAge(a, b)); But why create a lambda expression only to call to a method with the same signature? This is what a method reference is for!

Method References class Person { public static int compareByAge(Person a, Person b) { return a.dateOfBirth.compareTo(b.dateOfBirth); } public static void main(String … args) { Person[] people = getPeople(); Arrays.sort(people, Person::compareByAge); }

Stream API Stream API is an optimized way of working with Collections (List, Map, etc) Uses Lambda Expressions and Method References Brings Java in line with other languages that allow for quick collection processing (Perl, Python, Ruby)

Without Stream API List<String> strList = getStrings(); List<String> result = new ArrayList<String>(); for (String s : strList) { if (s.startsWith("abc")) { result.add(s); } } for (int idx = 0; idx < result.size(); idx++) { result.set(idx, result.get(idx).toUpperCase()); } result.sort(new Comparator<String>() { … return StringUtil.reverseSort(a, b); … } for (String s : result) { System.out.println(s); }

With Stream API List<String> strList = getStrings(); strList.stream() // opens the stream .filter(s -> s.startsWith("abc")) // filter the list .map(s -> s.toUpperCase()) // transform each item .parallel() // convert to parallel stream .sorted(StringUtil::reverseSort) // sort with existing method .forEach(s -> System.out.println(s)) // print each item

Java SE 9 – TBD – Early 2017 Codename: Jigsaw Features: Built-in Module System Jshell – interactive Java! Private Interface Methods Improved Process API Stackwalker Centralized Logging API Publisher/Subscriber Streams Collection Factory Methods HTTP/2 Support

Module System Some of us are familiar with the package-info.java file, which is for package level javadocs Java 9 introduces a module-info.java file that contains module info: module com.funcompany { requires java.logging; requires java.xml; exports com.funcompany.public.api; exports com.funcompany.public.domain; }

Module System Allows modules to declare dependencies (including potentially versions, still being refined) Allows modules to declare exported classes (i.e., code using the module will not be allowed to load private classes, even for reflection) Module relationships are documented with Javadoc Also allows for defining "services" for explicitly naming classes that provide service-like functionality

Jshell Interactive Java Shell Define classes, methods, variables, etc List what is in scope (what has been defined) Call methods, assign values to variables, import types Basically a playground for Java Demo

Q & A