SlideShare a Scribd company logo
The Well-Grounded Java Developer

      Introduction to Java 7
This is not an Oracle legal slide




                              2
No, we’re not in sales!
• Get in touch
   - Ben is: @kittylist
   - Martijn is: @karianna (and @diabolicaldev)


• What we do
   - Authors of “The Well-Grounded Java Developer”
   - CEO/CTO of jClarity - JVM/Hardware/Performance stuff


• We co-lead the LJC (London’s Java User Group)
   - Hold a seat on the JCP SE/EE Executive Committee
   - Run Adopt a JSR and Adopt OpenJDK programmes
Or in pictures...
How this session is going to work
 • This session may be a little different to advertised...
    - Being a “Well-Grounded Java Developer” changes over time


 • This session will go fairly quickly
    - But the slides will be made available
    - And you can always get hold of us for any questions


 • There are USB keys going around
    - Copy over the WGJD into $WORKSPACE
    - Install Java 7 if you haven't done so already!
    - Your major IDEs should work


 • Pair/Group programming works best
    - Have the least experienced person do the actual typing!
Attempted Timetable
Introduction to Java 7 - 0900-0955 (~55 mins)
      – BREAK (5 minutes)



Polyglot and functional programming - 1000-1030 (~30 mins)



BREAK (30 minutes)



Polyglot and functional programming - 1100-1125 (~25 mins)
      – BREAK (5 minutes)



Modern Java Concurrency - 1130-1230(~60 mins)
Real developers code through
       bathroom breaks




                          7
The Well-Grounded Java Developer...
   • Is not just a Java language whizz
      -   Understands the basics of the JVM
      -   Understands software development is a social activity
      -   Utilises software craftsmanship approaches
      -   Understands physical and logical architectures


   • Is using Java 7
      - At least at home if not at work


   • Is looking at polyglot and functional programming


   • Is looking at modern concurrency practices
Java 7 - Why is it important
• The WGJD wants to code rapidly


• The WGJD wants to code concisely


• The WGJD wants to take advantage of:
   - The compiler (including JIT)
   - The JVM (including GC)


• Java 7 gives you many improvements in these areas
OpenJDK - The Java 7/8 split
• 20 Sep 2010 - Mark Reinhold announces Plan B
   - Splits OpenJDK plan into Java 7 (July 2011) & Java 8 (2013)
   - Popular choice with the community


• July 2011 - Java 7 goes gold
   - Wow, a whole year ago now!


• Some new features to be delayed until JDK 8
   - Lambda Expressions
   - Modularisation (aka Jigsaw)


• JRockit features to be merged into OpenJDK
   - Enhanced management of the JVM
   - Ongoing merge of the VM engineering groups
Contents of JDK 7 Release
Project Coin



NIO.2



Method Handles



invokedynamic



Concurrency Refresh



Odds & Ends
Project Coin
• “Small” changes


• Language Level, not VM


• Stay away from the type system


• Developed in a very OSS manner
   - Was an ‘interesting’ experience for all involved
Project Coin - Highlights
Strings in switch


try-with-resources (aka ARM or TWR)


Diamond Syntax


Multi-catch with precise re-throw


Enhanced syntax for numeric literals


Varargs / autoboxing warning
Strings in switch




• Code along exercise: FeedingSchedule.java
try-with-resources
Diamond syntax




• Code along exercise: HordeOfOtters.java
Personally I’d stick to Java 1.4




                             17
NIO.2 - New I/O version 2
• A new file system and path abstraction


• Based on Path
   - An abstract view of a ‘file like’ system


• Files class contains many helper methods, including
   - File manipulation (copy, move, rename etc)
   - Walking directory trees
   - Native file system support (e.g. symbolic links)


• Works with existing java.io.File code
NIO.2 - New I/O version 2
• Asynchronous (non-blocking) I/O


• For sockets and files


• Mainly utilises java.util.concurrent.Future


• New NetworkChannel
   - Socket/Channel construct
   - Binding, options and multicast
Path and Files - Some examples




• Code along exercise: Housekeeping.java
URL stream to file - Java 6 style NIO
URL stream to file in Java 7




• Code along exercise: VetNotes.java
NIO.2 - Future base file I/O




• See ExceptionExamples.java as well (multi-catch)
Method Handles
• We already have Reflection API
   - It’s all pretty horrible


• JDK 7 introduces a new way to inspect at runtime


• Method Handles
   -   Represent the ability to call a method
   -   Implement subclass java.lang.invoke.MethodHandle
   -   Are strongly-typed and typesafe
   -   Needed for invokedynamic - but also used standalone
Example - ThreadPoolManager
Cancelling using Reflection
Cancelling using MethodHandle
invokedynamic

• invokedynamic is a key new JVM feature
   - It’s the first new bytecode since Java 1.0
   - Joins invokevirtual, invokestatic,
     invokeinterface and invokespecial


• Relaxes a key part of the static typing system
   - User code can determine dispatch at runtime


• Aims to be as fast as regular method dispatch
   - e.g. invokevirtual


• No Java syntax in Java 7
   - But maybe for Java 8
invokedynamic contd.
• JRuby, Jython, Groovy, Clojure et al all benefit
   - JRuby gains a lot, Clojure not so much
   - Even Scala is using it now!


• JRuby works closely with the JSR-292 team
   - Charlie Nutter (winner of JAX special jury award)
   - Big wins
   - Makes JRuby enticing to Ruby developers


• Java 8 also gets a boost
   - Lambdas will be implemented with invokedynamic
Other JVM Languages?
Meh - Use the Golden Hammer!




                          30
Java 7 Concurrency Refresh
• Java 7 has a number of new concurrency toys


• The headline item is Fork / Join
    - Similar to Map/Reduce, useful for a certain class of problems
    - Fork and join executions are not necessarily threads


• We’ll cover this in the final hour!
Java 7 - That’s not all
• Nimbus Look & Feel for Swing


• New helper classes including Objects
   - deepEquals() and friends


• JDBC with try-with-resources support


• Better unicode support
   - Thanks in part to Tom Christiansen of Perl fame


• More small changes in niche areas
New Faces in the OpenJDK
What We Didn’t Have Time To Talk About
    • Java 8
       - Java FX 2.x


    • Java EE 6/7


    • Java ME


    • JDK Enhancement Proposals (JEPs)


    • Java Community Process (JCP)
       - Java Specification Requests (JSRs)
       - Java User Groups (JUGs) and 'Adopt' programs
What? You still here?
Go take a break will you!




                            35
Ad

More Related Content

What's hot (20)

What's the "right" PHP Framework?
What's the "right" PHP Framework?What's the "right" PHP Framework?
What's the "right" PHP Framework?
Barry Jones
 
The Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot PersistenceThe Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot Persistence
Abdelmonaim Remani
 
Scala in the Wild
Scala in the WildScala in the Wild
Scala in the Wild
Tomer Gabel
 
L1 basics
L1 basicsL1 basics
L1 basics
teach4uin
 
PHP Frameworks Review - Mar 19 2015
PHP Frameworks Review - Mar 19 2015PHP Frameworks Review - Mar 19 2015
PHP Frameworks Review - Mar 19 2015
kyphpug
 
Kitware: Qt and Scientific Computing
Kitware: Qt and Scientific ComputingKitware: Qt and Scientific Computing
Kitware: Qt and Scientific Computing
account inactive
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksBuilding Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Atlassian
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
Amr Salah
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
roialdaag
 
Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?
C4Media
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVM
Alex Birch
 
History of java
History of javaHistory of java
History of java
Mani Sarkar
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
Dragos Manolescu
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting Started
Rakesh Madugula
 
Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)
Martijn Verburg
 
Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)
Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)
Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)
Kaunas Java User Group
 
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Java gc
Java gcJava gc
Java gc
Niit
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
Vinay H G
 
Scientific Computing - Hardware
Scientific Computing - HardwareScientific Computing - Hardware
Scientific Computing - Hardware
jalle6
 
What's the "right" PHP Framework?
What's the "right" PHP Framework?What's the "right" PHP Framework?
What's the "right" PHP Framework?
Barry Jones
 
The Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot PersistenceThe Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot Persistence
Abdelmonaim Remani
 
Scala in the Wild
Scala in the WildScala in the Wild
Scala in the Wild
Tomer Gabel
 
PHP Frameworks Review - Mar 19 2015
PHP Frameworks Review - Mar 19 2015PHP Frameworks Review - Mar 19 2015
PHP Frameworks Review - Mar 19 2015
kyphpug
 
Kitware: Qt and Scientific Computing
Kitware: Qt and Scientific ComputingKitware: Qt and Scientific Computing
Kitware: Qt and Scientific Computing
account inactive
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksBuilding Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Atlassian
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
Amr Salah
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
roialdaag
 
Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?Go - A Key Language in Enterprise Application Development?
Go - A Key Language in Enterprise Application Development?
C4Media
 
A tour of Java and the JVM
A tour of Java and the JVMA tour of Java and the JVM
A tour of Java and the JVM
Alex Birch
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
Dragos Manolescu
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting Started
Rakesh Madugula
 
Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)
Martijn Verburg
 
Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)
Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)
Kaunas JUG#1: Java History and Trends (Dainius Mezanskas)
Kaunas Java User Group
 
Java gc
Java gcJava gc
Java gc
Niit
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
Vinay H G
 
Scientific Computing - Hardware
Scientific Computing - HardwareScientific Computing - Hardware
Scientific Computing - Hardware
jalle6
 

Similar to Introduction to Java 7 (OSCON 2012) (20)

Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Mihail Stoynov
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
Fu Cheng
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
Arto Santala
 
OSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and AndroidOSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and Android
mfrancis
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
Arto Santala
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
Jesse Warden
 
01-Introduction.ppt
01-Introduction.ppt01-Introduction.ppt
01-Introduction.ppt
EmanAsem4
 
Java Basics
Java BasicsJava Basics
Java Basics
Fahad Shahzad
 
Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallery
njbartlett
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
Murugesh33
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
Murugesh33
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
sunmitraeducation
 
Java for XPages Development
Java for XPages DevelopmentJava for XPages Development
Java for XPages Development
Teamstudio
 
Java Closures
Java ClosuresJava Closures
Java Closures
Ben Evans
 
How can your applications benefit from Java 9?
How can your applications benefit from Java 9?How can your applications benefit from Java 9?
How can your applications benefit from Java 9?
EUR ING Ioannis Kolaxis MSc
 
How can your applications benefit from Java 9?
How can your applications benefit from Java 9?How can your applications benefit from Java 9?
How can your applications benefit from Java 9?
EUR ING Ioannis Kolaxis MSc
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS Projects
Taro L. Saito
 
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Mani Sarkar
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
Anton Keks
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
tutorialsruby
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Mihail Stoynov
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
Fu Cheng
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
Arto Santala
 
OSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and AndroidOSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and Android
mfrancis
 
Leaner microservices with Java 10
Leaner microservices with Java 10Leaner microservices with Java 10
Leaner microservices with Java 10
Arto Santala
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
Jesse Warden
 
01-Introduction.ppt
01-Introduction.ppt01-Introduction.ppt
01-Introduction.ppt
EmanAsem4
 
Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallery
njbartlett
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
Murugesh33
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
Murugesh33
 
Java for XPages Development
Java for XPages DevelopmentJava for XPages Development
Java for XPages Development
Teamstudio
 
Java Closures
Java ClosuresJava Closures
Java Closures
Ben Evans
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS Projects
Taro L. Saito
 
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Java 9 / Jigsaw - LJC / VJUG session (hackday session)
Mani Sarkar
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
Anton Keks
 
Ad

More from Martijn Verburg (6)

NoHR Hiring
NoHR HiringNoHR Hiring
NoHR Hiring
Martijn Verburg
 
Garbage Collection - The Useful Parts
Garbage Collection - The Useful PartsGarbage Collection - The Useful Parts
Garbage Collection - The Useful Parts
Martijn Verburg
 
Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)
Martijn Verburg
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
Martijn Verburg
 
How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)
Martijn Verburg
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
Martijn Verburg
 
Garbage Collection - The Useful Parts
Garbage Collection - The Useful PartsGarbage Collection - The Useful Parts
Garbage Collection - The Useful Parts
Martijn Verburg
 
Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)
Martijn Verburg
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
Martijn Verburg
 
How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)
Martijn Verburg
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
Martijn Verburg
 
Ad

Recently uploaded (20)

Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 

Introduction to Java 7 (OSCON 2012)

  • 1. The Well-Grounded Java Developer Introduction to Java 7
  • 2. This is not an Oracle legal slide 2
  • 3. No, we’re not in sales! • Get in touch - Ben is: @kittylist - Martijn is: @karianna (and @diabolicaldev) • What we do - Authors of “The Well-Grounded Java Developer” - CEO/CTO of jClarity - JVM/Hardware/Performance stuff • We co-lead the LJC (London’s Java User Group) - Hold a seat on the JCP SE/EE Executive Committee - Run Adopt a JSR and Adopt OpenJDK programmes
  • 5. How this session is going to work • This session may be a little different to advertised... - Being a “Well-Grounded Java Developer” changes over time • This session will go fairly quickly - But the slides will be made available - And you can always get hold of us for any questions • There are USB keys going around - Copy over the WGJD into $WORKSPACE - Install Java 7 if you haven't done so already! - Your major IDEs should work • Pair/Group programming works best - Have the least experienced person do the actual typing!
  • 6. Attempted Timetable Introduction to Java 7 - 0900-0955 (~55 mins) – BREAK (5 minutes) Polyglot and functional programming - 1000-1030 (~30 mins) BREAK (30 minutes) Polyglot and functional programming - 1100-1125 (~25 mins) – BREAK (5 minutes) Modern Java Concurrency - 1130-1230(~60 mins)
  • 7. Real developers code through bathroom breaks 7
  • 8. The Well-Grounded Java Developer... • Is not just a Java language whizz - Understands the basics of the JVM - Understands software development is a social activity - Utilises software craftsmanship approaches - Understands physical and logical architectures • Is using Java 7 - At least at home if not at work • Is looking at polyglot and functional programming • Is looking at modern concurrency practices
  • 9. Java 7 - Why is it important • The WGJD wants to code rapidly • The WGJD wants to code concisely • The WGJD wants to take advantage of: - The compiler (including JIT) - The JVM (including GC) • Java 7 gives you many improvements in these areas
  • 10. OpenJDK - The Java 7/8 split • 20 Sep 2010 - Mark Reinhold announces Plan B - Splits OpenJDK plan into Java 7 (July 2011) & Java 8 (2013) - Popular choice with the community • July 2011 - Java 7 goes gold - Wow, a whole year ago now! • Some new features to be delayed until JDK 8 - Lambda Expressions - Modularisation (aka Jigsaw) • JRockit features to be merged into OpenJDK - Enhanced management of the JVM - Ongoing merge of the VM engineering groups
  • 11. Contents of JDK 7 Release Project Coin NIO.2 Method Handles invokedynamic Concurrency Refresh Odds & Ends
  • 12. Project Coin • “Small” changes • Language Level, not VM • Stay away from the type system • Developed in a very OSS manner - Was an ‘interesting’ experience for all involved
  • 13. Project Coin - Highlights Strings in switch try-with-resources (aka ARM or TWR) Diamond Syntax Multi-catch with precise re-throw Enhanced syntax for numeric literals Varargs / autoboxing warning
  • 14. Strings in switch • Code along exercise: FeedingSchedule.java
  • 16. Diamond syntax • Code along exercise: HordeOfOtters.java
  • 17. Personally I’d stick to Java 1.4 17
  • 18. NIO.2 - New I/O version 2 • A new file system and path abstraction • Based on Path - An abstract view of a ‘file like’ system • Files class contains many helper methods, including - File manipulation (copy, move, rename etc) - Walking directory trees - Native file system support (e.g. symbolic links) • Works with existing java.io.File code
  • 19. NIO.2 - New I/O version 2 • Asynchronous (non-blocking) I/O • For sockets and files • Mainly utilises java.util.concurrent.Future • New NetworkChannel - Socket/Channel construct - Binding, options and multicast
  • 20. Path and Files - Some examples • Code along exercise: Housekeeping.java
  • 21. URL stream to file - Java 6 style NIO
  • 22. URL stream to file in Java 7 • Code along exercise: VetNotes.java
  • 23. NIO.2 - Future base file I/O • See ExceptionExamples.java as well (multi-catch)
  • 24. Method Handles • We already have Reflection API - It’s all pretty horrible • JDK 7 introduces a new way to inspect at runtime • Method Handles - Represent the ability to call a method - Implement subclass java.lang.invoke.MethodHandle - Are strongly-typed and typesafe - Needed for invokedynamic - but also used standalone
  • 28. invokedynamic • invokedynamic is a key new JVM feature - It’s the first new bytecode since Java 1.0 - Joins invokevirtual, invokestatic, invokeinterface and invokespecial • Relaxes a key part of the static typing system - User code can determine dispatch at runtime • Aims to be as fast as regular method dispatch - e.g. invokevirtual • No Java syntax in Java 7 - But maybe for Java 8
  • 29. invokedynamic contd. • JRuby, Jython, Groovy, Clojure et al all benefit - JRuby gains a lot, Clojure not so much - Even Scala is using it now! • JRuby works closely with the JSR-292 team - Charlie Nutter (winner of JAX special jury award) - Big wins - Makes JRuby enticing to Ruby developers • Java 8 also gets a boost - Lambdas will be implemented with invokedynamic
  • 30. Other JVM Languages? Meh - Use the Golden Hammer! 30
  • 31. Java 7 Concurrency Refresh • Java 7 has a number of new concurrency toys • The headline item is Fork / Join - Similar to Map/Reduce, useful for a certain class of problems - Fork and join executions are not necessarily threads • We’ll cover this in the final hour!
  • 32. Java 7 - That’s not all • Nimbus Look & Feel for Swing • New helper classes including Objects - deepEquals() and friends • JDBC with try-with-resources support • Better unicode support - Thanks in part to Tom Christiansen of Perl fame • More small changes in niche areas
  • 33. New Faces in the OpenJDK
  • 34. What We Didn’t Have Time To Talk About • Java 8 - Java FX 2.x • Java EE 6/7 • Java ME • JDK Enhancement Proposals (JEPs) • Java Community Process (JCP) - Java Specification Requests (JSRs) - Java User Groups (JUGs) and 'Adopt' programs
  • 35. What? You still here? Go take a break will you! 35

Editor's Notes

  • #2: TODO: Overall if we have time, replace images of code with actual code\n
  • #3: First laugh of the day\n
  • #4: We're (Fairly) old (mostly FOSS) hackers and cause trouble at conferences\nBen is known for his performance & concurrency work\nMartijn is also known as the “Diabolical Developer”\n
  • #5: * Charities, financial services and beer.\n
  • #6: \n
  • #7: * No plan survives contact with the enemy, that would be you guys!\n
  • #8: In reference to timeline\n
  • #9: \n
  • #10: \n
  • #11: * Surprising fact, but the largest group of engineers ever were deployed on Java 7\nWe'll cover Java 8 in our talk later this week!\nClosures, Lambdas, SAM literals\n
  • #12: \n
  • #13: Most developers make f&^^%n terrible language designers\nWant to get involved? Talk to us about Adopt OpenJDK\n
  • #14: \n
  • #15: * Incidentally JSR 310 provides much better date and time handling, join our Adopt a JSR program to learn more!\n
  • #16: \n
  • #17: \n
  • #18: In reference to how awesome the coin features are\n
  • #19: \n
  • #20: \n
  • #21: \n
  • #22: \n
  • #23: * "So we had a bit of a fail with our domain hosting agency..."\n* TODO - We need to provide some text files hosted at a URL\n
  • #24: * Do the “who knows j.u.c”? question at the start\n* Spot the numeric literal! \n
  • #25: TODO: “I want my Coffee!” physical theatre\n
  • #26: See & use interfaces/classes/methods and fields at runtime.\n* Call methods without knowing their names at runtime\n* Think “Reflection done in a safe and modern way\n
  • #27: TODO: Do we have a simpler example? Perhaps we could extract the Runnable into a local var for readability?\nTODO: Was this the one with the code bug?\n
  • #28: * Spot the setAccessible() - we need to make the private method accessible\n
  • #29: Lookup happens in the context where it’s called from.\nMeans that if you lookup() from inside a class, you can see all the private methods.\nThen you can selectively hand out a reference for others to call them.\n* Method handle calls can be inlined through\n* Also unreflect\n
  • #30: * Method names / signatures will not need to be known at compile time\n* uses MethodHandle\n
  • #31: \n
  • #32: In reference to how awesome invokedynamic is\n
  • #33: \n
  • #34: * Talk to the pattern in the many Java libraries - Foo / AbstractFoo / Foos\n
  • #35: \n
  • #36: \n
  • #37: \n