SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
Evolving
            the
Java Programming Language


         Neal Gafter
Overview


The Challenge of Evolving a Language
Design Principles
Design Goals
JDK7 and JDK8
Challenge: Evolving a Language


“What is it like trying to extend a mature lan-
  guage?” -Brian Goetz
Challenge: Evolving a Language


“What is it like trying to extend a mature lan-
  guage?”

ma-ture: adjective
1. having completed natural growth and de-
   velopment.
2. completed, perfected, or elaborated in full.
3. (of an industry, technology, market, etc.) no
   longer developing or expanding.
Challenge: Evolving a Language


Q: What is it like trying to extend a mature
  language?


A: It is impossible, by definition.
Challenge: Evolving a Language


Q: What is it like trying to extend a widely de-
  ployed language?

A: Language change is influenced by existing
  code and APIs.
Existing APIs affect change



Support retrofitting existing APIs:
  With compatible behavior
Existing APIs affect change



Support retrofitting existing APIs:
  With compatible behavior

  Consistent with existing design
    Don't expose, create design flaws
Existing APIs affect change


Some case studies:

  Generics (vs erasure)
  Wildcards (vs declaration-site variance)
  Autoboxing, unboxing (vs wrappers)
  Varargs (vs overloading)
  For-each (vs Iterator)
Generics (vs erasure)




Adding reified generics is compatible
May not allow retrofitting existing code
 Collection
 WeakReference
Wildcards (vs declaration-site
           variance)

There is a simpler alternative to wildcards:
  declaration-site variance

  'wildcards' appear on type definitions
  Use sites much simpler
  Can retrofit most APIs
    but not Collection
Autoboxing, unboxing


Type systems form a lattice

       Object
     /        
Number Runnable
   |           /
Integer /
           /
       null
Autoboxing, unboxing


Adding conversions can break the lattice

long <----------> Long
  |                 |
  |                 |
int <----------> Integer

Existing boxed types don't have this relation.
Autoboxing, unboxing


Solutions

  Introduce new boxing interfaces; or
  Patchwork specification
for-each (vs iterator)



Iterator has a vestigal remove method.
Introduce java.lang.Iterator without it?
Cannot retrofit Collection
 without requiring recompile

 (existing implementations don't implement
 iterator() that returns the new type)
Design Principles
Design Principles


Encourage desirable practices (that might
not otherwise be followed) my making them
easy
 synchronized
 Annotations isolate configuration data
 Generics for typesafe APIs
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Prefer reading over writing
 clarity over conciseness
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Prefer reading over writing
Prefer static typing
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Prefer reading over writing
Prefer static typing
Remain backward compatible
Short-term design Goals


Regularize Existing Language
 Improve diagnostics vs generics
 Fix type inference
 String switch
 Limited operator overloading
 Improved catch clauses
Modularity
Improve Diagnostics vs Generics

interface Box<T> {
    T get();
    void put(T t);
}
class Tmp {
    static void test(Box<? extends Number> box) {
        box.put(box.get());
    }
}

Error: put(capture#417 of ? extends java.lang.Number)
   in Box<capture#417 of ? extends java.lang.Number>
   cannot be applied to (java.lang.Number)
        box.put(box.get());
           ^
Improve Diagnostics vs Generics

interface Box<T> {
    T get();
    void put(T t);
}
class Tmp {
    static void test(Box<? extends Number> box) {
        box.put(box.get());
    }
}

Error: cannot call put(T) as a member of in Box<? ex-
   tends java.lang.Number>
        box.put(box.get());
           ^
Fix Type Inference: constructors


  Today:

Map<String, List<String>> anagrams
 = new HashMap<String,
 List<String>>();
Fix Type Inference: constructors


  Proposed:

Map<String, List<String>> anagrams
 = new HashMap<>();
Fix Type Inference: arguments


  Today:

public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) { … }

// * Won't compile!
timeWaitsFor(Collections.emptySet());
Fix Type Inference: arguments


  Today:

public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) { … }

// OK
timeWaitsFor(Collections.<Man>emptySet());
Fix Type Inference: arguments


  Proposed:

public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) { … }

// OK
timeWaitsFor(Collections.emptySet());
String Switch


   Today

static boolean booleanFromString(String s) {
    if (s.equals(quot;truequot;)) {
        return true;
    } else if (s.equals(quot;falsequot;)) {
        return false;
    } else {
        throw new IllegalArgumentException(s);
    }
}
String Switch


   Proposed

static boolean booleanFromString(String s) {
    switch(s) {
      case quot;truequot;:
        return true;
      case quot;falsequot;:
        return false;
      default:
        throw new IllegalArgumentException(s);
    }
}
Limited Operator Overloading


   Today

enum Size { SMALL, MEDIUM, LARGE }

if (mySize.compareTo(yourSize) >= 0)
    System.out.println(“You can wear my pants.”);
Limited Operator Overloading


   Proposed


enum Size { SMALL, MEDIUM, LARGE }

if (mySize > yourSize)
    System.out.println(“You can wear my pants.”);
Improved Catch Clauses: multi


   Today:

try {
    return klass.newInstance();
} catch (InstantiationException e) {
    throw new AssertionError(e);
} catch (IllegalAccessException e) {
    throw new AssertionError(e);
}
Improved Catch Clauses: multi


   Proposed:

try {
    return klass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
    throw new AssertionError(e);
}
Improved Catch Clauses: rethrow


   Today:

try {
  doable.doit(); // Throws several types
} catch (Throwable ex) {
  logger.log(ex);
  throw ex; // Error: Throwable not declared
}
Improved Catch Clauses: rethrow


   Proposed:

try {
  doable.doit(); // Throws several types
} catch (final Throwable ex) {
  logger.log(ex);
  throw ex; // OK: Throws the same several types
}
Others?


Properties?
Serialization annotations?
Long-term goals


Regularize Existing Language
 Reification
 Further Generics simplification

Concurrency support
 Immutable data
 Control Abstraction
 Closures
 Actors, etc.
JDK7


jsrs 277 + 294 (modularity)
Maintenance review of jsr14
“Small” language issues
Possibly jsr308

(limited by time, resources)
JDK8


  Reification
  Control Abstraction



Further out: Immutable data, pattern match-
 ing, further operator overloading?
Q&A

Contenu connexe

Tendances

Keep your repo clean
Keep your repo cleanKeep your repo clean
Keep your repo cleanHector Canto
 
Test in action – week 1
Test in action – week 1Test in action – week 1
Test in action – week 1Yi-Huan Chan
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummiesHarry Potter
 
Test in action week 2
Test in action   week 2Test in action   week 2
Test in action week 2Yi-Huan Chan
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with GroovyArturo Herrero
 
Test in action week 4
Test in action   week 4Test in action   week 4
Test in action week 4Yi-Huan Chan
 
Unit Testing Presentation
Unit Testing PresentationUnit Testing Presentation
Unit Testing Presentationnicobn
 
Advanced PHPUnit Testing
Advanced PHPUnit TestingAdvanced PHPUnit Testing
Advanced PHPUnit TestingMike Lively
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytestHector Canto
 
Test driven node.js
Test driven node.jsTest driven node.js
Test driven node.jsJay Harris
 
Python Unit Test
Python Unit TestPython Unit Test
Python Unit TestDavid Xie
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Timo Stollenwerk
 
YAPC::NA 2007 - An Introduction To Perl Critic
YAPC::NA 2007 - An Introduction To Perl CriticYAPC::NA 2007 - An Introduction To Perl Critic
YAPC::NA 2007 - An Introduction To Perl Criticjoshua.mcadams
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
Scalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedInScalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedInVitaly Gordon
 
Python Debugging Fundamentals
Python Debugging FundamentalsPython Debugging Fundamentals
Python Debugging Fundamentalscbcunc
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 

Tendances (20)

Keep your repo clean
Keep your repo cleanKeep your repo clean
Keep your repo clean
 
Polyglot JVM
Polyglot JVMPolyglot JVM
Polyglot JVM
 
Test in action – week 1
Test in action – week 1Test in action – week 1
Test in action – week 1
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
 
Test in action week 2
Test in action   week 2Test in action   week 2
Test in action week 2
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
Test in action week 4
Test in action   week 4Test in action   week 4
Test in action week 4
 
Unit Testing Presentation
Unit Testing PresentationUnit Testing Presentation
Unit Testing Presentation
 
Advanced PHPUnit Testing
Advanced PHPUnit TestingAdvanced PHPUnit Testing
Advanced PHPUnit Testing
 
PHPUnit
PHPUnitPHPUnit
PHPUnit
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytest
 
Test driven node.js
Test driven node.jsTest driven node.js
Test driven node.js
 
Python Unit Test
Python Unit TestPython Unit Test
Python Unit Test
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
 
YAPC::NA 2007 - An Introduction To Perl Critic
YAPC::NA 2007 - An Introduction To Perl CriticYAPC::NA 2007 - An Introduction To Perl Critic
YAPC::NA 2007 - An Introduction To Perl Critic
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Scalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedInScalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedIn
 
Python unittest
Python unittestPython unittest
Python unittest
 
Python Debugging Fundamentals
Python Debugging FundamentalsPython Debugging Fundamentals
Python Debugging Fundamentals
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 

En vedette

Tega Cay Trails
Tega Cay TrailsTega Cay Trails
Tega Cay TrailsBen Ullman
 
Penguin, Penalties and 'Big Data' - How I analyzed 250,000 domains
Penguin, Penalties and 'Big Data' - How I analyzed 250,000 domainsPenguin, Penalties and 'Big Data' - How I analyzed 250,000 domains
Penguin, Penalties and 'Big Data' - How I analyzed 250,000 domainsIan Lurie
 
Nyc Crane Collapse
Nyc Crane CollapseNyc Crane Collapse
Nyc Crane Collapsedwessin
 
Why Hire Portent?
Why Hire Portent?Why Hire Portent?
Why Hire Portent?Ian Lurie
 
Migrating to open unified communication
Migrating to open unified communicationMigrating to open unified communication
Migrating to open unified communicationOlle E Johansson
 
Orbul Si Ziaristul
Orbul Si ZiaristulOrbul Si Ziaristul
Orbul Si ZiaristulAlexandru S
 
Avid Powerpoint by Group 5
Avid Powerpoint by Group 5Avid Powerpoint by Group 5
Avid Powerpoint by Group 5barryrbarber
 
Terapia Masculina
Terapia MasculinaTerapia Masculina
Terapia MasculinaAlexandru S
 
Saved (part 2)
Saved (part 2)Saved (part 2)
Saved (part 2)jzatko
 
Kevlin Henney Effective Design
Kevlin Henney Effective DesignKevlin Henney Effective Design
Kevlin Henney Effective Designdeimos
 
World Tower Sculpture Proposal
World Tower Sculpture ProposalWorld Tower Sculpture Proposal
World Tower Sculpture ProposalBockit
 
Collaborating in the Clouds: selecting tools
Collaborating in the Clouds: selecting toolsCollaborating in the Clouds: selecting tools
Collaborating in the Clouds: selecting toolsBobbi Newman
 
Front end development - Les 01
Front end development - Les 01Front end development - Les 01
Front end development - Les 01Atticus
 
Academic research
Academic researchAcademic research
Academic researchlibrfun
 
Het Spel Van De Wereld
Het Spel Van De WereldHet Spel Van De Wereld
Het Spel Van De WereldyentelB
 
TRANSICION TERRENO
TRANSICION TERRENOTRANSICION TERRENO
TRANSICION TERRENOguest0ea344
 

En vedette (20)

Tega Cay Trails
Tega Cay TrailsTega Cay Trails
Tega Cay Trails
 
Penguin, Penalties and 'Big Data' - How I analyzed 250,000 domains
Penguin, Penalties and 'Big Data' - How I analyzed 250,000 domainsPenguin, Penalties and 'Big Data' - How I analyzed 250,000 domains
Penguin, Penalties and 'Big Data' - How I analyzed 250,000 domains
 
Nyc Crane Collapse
Nyc Crane CollapseNyc Crane Collapse
Nyc Crane Collapse
 
Why Hire Portent?
Why Hire Portent?Why Hire Portent?
Why Hire Portent?
 
Migrating to open unified communication
Migrating to open unified communicationMigrating to open unified communication
Migrating to open unified communication
 
web2.0
web2.0web2.0
web2.0
 
Orbul Si Ziaristul
Orbul Si ZiaristulOrbul Si Ziaristul
Orbul Si Ziaristul
 
Avid Powerpoint by Group 5
Avid Powerpoint by Group 5Avid Powerpoint by Group 5
Avid Powerpoint by Group 5
 
Terapia Masculina
Terapia MasculinaTerapia Masculina
Terapia Masculina
 
Saved (part 2)
Saved (part 2)Saved (part 2)
Saved (part 2)
 
Kevlin Henney Effective Design
Kevlin Henney Effective DesignKevlin Henney Effective Design
Kevlin Henney Effective Design
 
World Tower Sculpture Proposal
World Tower Sculpture ProposalWorld Tower Sculpture Proposal
World Tower Sculpture Proposal
 
Collaborating in the Clouds: selecting tools
Collaborating in the Clouds: selecting toolsCollaborating in the Clouds: selecting tools
Collaborating in the Clouds: selecting tools
 
Front end development - Les 01
Front end development - Les 01Front end development - Les 01
Front end development - Les 01
 
Academic research
Academic researchAcademic research
Academic research
 
God
GodGod
God
 
Nahum
NahumNahum
Nahum
 
Het Spel Van De Wereld
Het Spel Van De WereldHet Spel Van De Wereld
Het Spel Van De Wereld
 
Top50 Romania
Top50 RomaniaTop50 Romania
Top50 Romania
 
TRANSICION TERRENO
TRANSICION TERRENOTRANSICION TERRENO
TRANSICION TERRENO
 

Similaire à Neal Gafter Java Evolution

Evolving The Java Language
Evolving The Java LanguageEvolving The Java Language
Evolving The Java LanguageQConLondon2008
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeFederico Tomassetti
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Agora Group
 
Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Eric Phan
 
Best Practices for Quality Code
Best Practices for Quality CodeBest Practices for Quality Code
Best Practices for Quality CodeSercan Degirmenci
 
Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Andres Almiray
 
New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - GreachHamletDRC
 
Linq 1224887336792847 9
Linq 1224887336792847 9Linq 1224887336792847 9
Linq 1224887336792847 9google
 
Linq To The Enterprise
Linq To The EnterpriseLinq To The Enterprise
Linq To The EnterpriseDaniel Egan
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddSrinivasa GV
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche EheReact mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Eheinovex GmbH
 
Nagios Conference 2013 - BOF Nagios Plugins New Threshold Specification Syntax
Nagios Conference 2013 - BOF Nagios Plugins New Threshold Specification SyntaxNagios Conference 2013 - BOF Nagios Plugins New Threshold Specification Syntax
Nagios Conference 2013 - BOF Nagios Plugins New Threshold Specification SyntaxNagios
 
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Raffi Khatchadourian
 

Similaire à Neal Gafter Java Evolution (20)

Evolving The Java Language
Evolving The Java LanguageEvolving The Java Language
Evolving The Java Language
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Svcc Groovy Testing
Svcc Groovy TestingSvcc Groovy Testing
Svcc Groovy Testing
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java code
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011
 
Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!Why you should be using the shiny new C# 6.0 features now!
Why you should be using the shiny new C# 6.0 features now!
 
Best Practices for Quality Code
Best Practices for Quality CodeBest Practices for Quality Code
Best Practices for Quality Code
 
Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010
 
New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - Greach
 
Linq 1224887336792847 9
Linq 1224887336792847 9Linq 1224887336792847 9
Linq 1224887336792847 9
 
Linq To The Enterprise
Linq To The EnterpriseLinq To The Enterprise
Linq To The Enterprise
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tdd
 
Json generation
Json generationJson generation
Json generation
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche EheReact mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Ehe
 
Headless Js Testing
Headless Js TestingHeadless Js Testing
Headless Js Testing
 
Nagios Conference 2013 - BOF Nagios Plugins New Threshold Specification Syntax
Nagios Conference 2013 - BOF Nagios Plugins New Threshold Specification SyntaxNagios Conference 2013 - BOF Nagios Plugins New Threshold Specification Syntax
Nagios Conference 2013 - BOF Nagios Plugins New Threshold Specification Syntax
 
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
 

Plus de deimos

Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Rubydeimos
 
Randy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural PrinciplesRandy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural Principlesdeimos
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuerydeimos
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvmdeimos
 
Joe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand DwrJoe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand Dwrdeimos
 
Aslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec BddAslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec Bdddeimos
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovydeimos
 
Venkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic LanguagesVenkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic Languagesdeimos
 
Udi Dahan Intentions And Interfaces
Udi Dahan Intentions And InterfacesUdi Dahan Intentions And Interfaces
Udi Dahan Intentions And Interfacesdeimos
 
Tim Mackinnon Agile And Beyond
Tim Mackinnon Agile And BeyondTim Mackinnon Agile And Beyond
Tim Mackinnon Agile And Beyonddeimos
 
Steve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And SerendipitySteve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And Serendipitydeimos
 
Stefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The WebStefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The Webdeimos
 
Stefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To RestStefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To Restdeimos
 
Rod Johnson Cathedral
Rod Johnson CathedralRod Johnson Cathedral
Rod Johnson Cathedraldeimos
 
Mike Stolz Dramatic Scalability
Mike Stolz Dramatic ScalabilityMike Stolz Dramatic Scalability
Mike Stolz Dramatic Scalabilitydeimos
 
Matt Youill Betfair
Matt Youill BetfairMatt Youill Betfair
Matt Youill Betfairdeimos
 
Pete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two SystemsPete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two Systemsdeimos
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registrydeimos
 
Ola Bini Evolving The Java Platform
Ola Bini Evolving The Java PlatformOla Bini Evolving The Java Platform
Ola Bini Evolving The Java Platformdeimos
 
Markus Voelter Textual DSLs
Markus Voelter Textual DSLsMarkus Voelter Textual DSLs
Markus Voelter Textual DSLsdeimos
 

Plus de deimos (20)

Aspect Orientated Programming in Ruby
Aspect Orientated Programming in RubyAspect Orientated Programming in Ruby
Aspect Orientated Programming in Ruby
 
Randy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural PrinciplesRandy Shoup eBays Architectural Principles
Randy Shoup eBays Architectural Principles
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
 
Joe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand DwrJoe Walker Interactivewebsites Cometand Dwr
Joe Walker Interactivewebsites Cometand Dwr
 
Aslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec BddAslak Hellesoy Executable User Stories R Spec Bdd
Aslak Hellesoy Executable User Stories R Spec Bdd
 
Venkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In GroovyVenkat Subramaniam Building DSLs In Groovy
Venkat Subramaniam Building DSLs In Groovy
 
Venkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic LanguagesVenkat Subramaniam Blending Java With Dynamic Languages
Venkat Subramaniam Blending Java With Dynamic Languages
 
Udi Dahan Intentions And Interfaces
Udi Dahan Intentions And InterfacesUdi Dahan Intentions And Interfaces
Udi Dahan Intentions And Interfaces
 
Tim Mackinnon Agile And Beyond
Tim Mackinnon Agile And BeyondTim Mackinnon Agile And Beyond
Tim Mackinnon Agile And Beyond
 
Steve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And SerendipitySteve Vinoski Rest And Reuse And Serendipity
Steve Vinoski Rest And Reuse And Serendipity
 
Stefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The WebStefan Tilkov Soa Rest And The Web
Stefan Tilkov Soa Rest And The Web
 
Stefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To RestStefan Tilkov Pragmatic Intro To Rest
Stefan Tilkov Pragmatic Intro To Rest
 
Rod Johnson Cathedral
Rod Johnson CathedralRod Johnson Cathedral
Rod Johnson Cathedral
 
Mike Stolz Dramatic Scalability
Mike Stolz Dramatic ScalabilityMike Stolz Dramatic Scalability
Mike Stolz Dramatic Scalability
 
Matt Youill Betfair
Matt Youill BetfairMatt Youill Betfair
Matt Youill Betfair
 
Pete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two SystemsPete Goodliffe A Tale Of Two Systems
Pete Goodliffe A Tale Of Two Systems
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registry
 
Ola Bini Evolving The Java Platform
Ola Bini Evolving The Java PlatformOla Bini Evolving The Java Platform
Ola Bini Evolving The Java Platform
 
Markus Voelter Textual DSLs
Markus Voelter Textual DSLsMarkus Voelter Textual DSLs
Markus Voelter Textual DSLs
 

Dernier

Developing Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, OursDeveloping Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, OursKaiNexus
 
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...Khaled Al Awadi
 
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptxHELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptxHelene Heckrotte
 
BCE24 | Virtual Brand Ambassadors: Making Brands Personal - John Meulemans
BCE24 | Virtual Brand Ambassadors: Making Brands Personal - John MeulemansBCE24 | Virtual Brand Ambassadors: Making Brands Personal - John Meulemans
BCE24 | Virtual Brand Ambassadors: Making Brands Personal - John MeulemansBBPMedia1
 
AMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdf
AMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdfAMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdf
AMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdfJohnCarloValencia4
 
MoneyBridge Pitch Deck - Investor Presentation
MoneyBridge Pitch Deck - Investor PresentationMoneyBridge Pitch Deck - Investor Presentation
MoneyBridge Pitch Deck - Investor Presentationbaron83
 
Human Resource Management Chapter 9: Performance Management and Appraisal
Human Resource Management Chapter 9: Performance Management and AppraisalHuman Resource Management Chapter 9: Performance Management and Appraisal
Human Resource Management Chapter 9: Performance Management and Appraisalgomezdominic3
 
Slicing Work on Business Agility Meetup Berlin
Slicing Work on Business Agility Meetup BerlinSlicing Work on Business Agility Meetup Berlin
Slicing Work on Business Agility Meetup BerlinAnton Skornyakov
 
IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...
IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...
IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...AustraliaChapterIIBA
 
Data skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story pointsData skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story pointsyasinnathani
 
Borderless Access - Global Panel book-unlock 2024
Borderless Access - Global Panel book-unlock 2024Borderless Access - Global Panel book-unlock 2024
Borderless Access - Global Panel book-unlock 2024Borderless Access
 
Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access
 
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISINGUNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISINGlokeshwarmaha
 
Q2 2024 APCO Geopolitical Radar - The Global Operating Environment for Business
Q2 2024 APCO Geopolitical Radar - The Global Operating Environment for BusinessQ2 2024 APCO Geopolitical Radar - The Global Operating Environment for Business
Q2 2024 APCO Geopolitical Radar - The Global Operating Environment for BusinessAPCO
 
Transform Your Kitchen Essential Tips for Renovations in Launceston
Transform Your Kitchen Essential Tips for Renovations in LauncestonTransform Your Kitchen Essential Tips for Renovations in Launceston
Transform Your Kitchen Essential Tips for Renovations in Launcestondjhbuildersau
 
7movierulz.uk
7movierulz.uk7movierulz.uk
7movierulz.ukaroemirsr
 
Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access
 
PDT 88 - 4 million seed - Seed - Protecto.pdf
PDT 88 - 4 million seed - Seed - Protecto.pdfPDT 88 - 4 million seed - Seed - Protecto.pdf
PDT 88 - 4 million seed - Seed - Protecto.pdfHajeJanKamps
 

Dernier (20)

Developing Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, OursDeveloping Coaching Skills: Mine, Yours, Ours
Developing Coaching Skills: Mine, Yours, Ours
 
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...NewBase  25 March  2024  Energy News issue - 1710 by Khaled Al Awadi_compress...
NewBase 25 March 2024 Energy News issue - 1710 by Khaled Al Awadi_compress...
 
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptxHELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
HELENE HECKROTTE'S PROFESSIONAL PORTFOLIO.pptx
 
BCE24 | Virtual Brand Ambassadors: Making Brands Personal - John Meulemans
BCE24 | Virtual Brand Ambassadors: Making Brands Personal - John MeulemansBCE24 | Virtual Brand Ambassadors: Making Brands Personal - John Meulemans
BCE24 | Virtual Brand Ambassadors: Making Brands Personal - John Meulemans
 
AMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdf
AMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdfAMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdf
AMAZON SELLER VIRTUAL ASSISTANT PRODUCT RESEARCH .pdf
 
MoneyBridge Pitch Deck - Investor Presentation
MoneyBridge Pitch Deck - Investor PresentationMoneyBridge Pitch Deck - Investor Presentation
MoneyBridge Pitch Deck - Investor Presentation
 
Human Resource Management Chapter 9: Performance Management and Appraisal
Human Resource Management Chapter 9: Performance Management and AppraisalHuman Resource Management Chapter 9: Performance Management and Appraisal
Human Resource Management Chapter 9: Performance Management and Appraisal
 
Slicing Work on Business Agility Meetup Berlin
Slicing Work on Business Agility Meetup BerlinSlicing Work on Business Agility Meetup Berlin
Slicing Work on Business Agility Meetup Berlin
 
AL Satwa Dubai Call Girls +971552825767 Call Girls In AL Karama
AL Satwa Dubai Call Girls +971552825767  Call Girls In AL KaramaAL Satwa Dubai Call Girls +971552825767  Call Girls In AL Karama
AL Satwa Dubai Call Girls +971552825767 Call Girls In AL Karama
 
IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...
IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...
IIBA® Melbourne - Navigating Business Analysis - Excellence for Career Growth...
 
Data skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story pointsData skills for Agile Teams- Killing story points
Data skills for Agile Teams- Killing story points
 
Borderless Access - Global Panel book-unlock 2024
Borderless Access - Global Panel book-unlock 2024Borderless Access - Global Panel book-unlock 2024
Borderless Access - Global Panel book-unlock 2024
 
Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024
 
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISINGUNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
UNLEASHING THE POWER OF PROGRAMMATIC ADVERTISING
 
WAM Corporate Presentation Mar 25 2024.pdf
WAM Corporate Presentation Mar 25 2024.pdfWAM Corporate Presentation Mar 25 2024.pdf
WAM Corporate Presentation Mar 25 2024.pdf
 
Q2 2024 APCO Geopolitical Radar - The Global Operating Environment for Business
Q2 2024 APCO Geopolitical Radar - The Global Operating Environment for BusinessQ2 2024 APCO Geopolitical Radar - The Global Operating Environment for Business
Q2 2024 APCO Geopolitical Radar - The Global Operating Environment for Business
 
Transform Your Kitchen Essential Tips for Renovations in Launceston
Transform Your Kitchen Essential Tips for Renovations in LauncestonTransform Your Kitchen Essential Tips for Renovations in Launceston
Transform Your Kitchen Essential Tips for Renovations in Launceston
 
7movierulz.uk
7movierulz.uk7movierulz.uk
7movierulz.uk
 
Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024Borderless Access - Global B2B Panel book-unlock 2024
Borderless Access - Global B2B Panel book-unlock 2024
 
PDT 88 - 4 million seed - Seed - Protecto.pdf
PDT 88 - 4 million seed - Seed - Protecto.pdfPDT 88 - 4 million seed - Seed - Protecto.pdf
PDT 88 - 4 million seed - Seed - Protecto.pdf
 

Neal Gafter Java Evolution

  • 1. Evolving the Java Programming Language Neal Gafter
  • 2. Overview The Challenge of Evolving a Language Design Principles Design Goals JDK7 and JDK8
  • 3. Challenge: Evolving a Language “What is it like trying to extend a mature lan- guage?” -Brian Goetz
  • 4. Challenge: Evolving a Language “What is it like trying to extend a mature lan- guage?” ma-ture: adjective 1. having completed natural growth and de- velopment. 2. completed, perfected, or elaborated in full. 3. (of an industry, technology, market, etc.) no longer developing or expanding.
  • 5. Challenge: Evolving a Language Q: What is it like trying to extend a mature language? A: It is impossible, by definition.
  • 6. Challenge: Evolving a Language Q: What is it like trying to extend a widely de- ployed language? A: Language change is influenced by existing code and APIs.
  • 7. Existing APIs affect change Support retrofitting existing APIs: With compatible behavior
  • 8. Existing APIs affect change Support retrofitting existing APIs: With compatible behavior Consistent with existing design Don't expose, create design flaws
  • 9. Existing APIs affect change Some case studies: Generics (vs erasure) Wildcards (vs declaration-site variance) Autoboxing, unboxing (vs wrappers) Varargs (vs overloading) For-each (vs Iterator)
  • 10. Generics (vs erasure) Adding reified generics is compatible May not allow retrofitting existing code Collection WeakReference
  • 11. Wildcards (vs declaration-site variance) There is a simpler alternative to wildcards: declaration-site variance 'wildcards' appear on type definitions Use sites much simpler Can retrofit most APIs but not Collection
  • 12. Autoboxing, unboxing Type systems form a lattice Object / Number Runnable | / Integer / / null
  • 13. Autoboxing, unboxing Adding conversions can break the lattice long <----------> Long | | | | int <----------> Integer Existing boxed types don't have this relation.
  • 14. Autoboxing, unboxing Solutions Introduce new boxing interfaces; or Patchwork specification
  • 15. for-each (vs iterator) Iterator has a vestigal remove method. Introduce java.lang.Iterator without it? Cannot retrofit Collection without requiring recompile (existing implementations don't implement iterator() that returns the new type)
  • 17. Design Principles Encourage desirable practices (that might not otherwise be followed) my making them easy synchronized Annotations isolate configuration data Generics for typesafe APIs
  • 18. Design Principles Encourage desirable practices Isolate language from specific APIs
  • 19. Design Principles Encourage desirable practices Isolate language from specific APIs Prefer reading over writing clarity over conciseness
  • 20. Design Principles Encourage desirable practices Isolate language from specific APIs Prefer reading over writing Prefer static typing
  • 21. Design Principles Encourage desirable practices Isolate language from specific APIs Prefer reading over writing Prefer static typing Remain backward compatible
  • 22. Short-term design Goals Regularize Existing Language Improve diagnostics vs generics Fix type inference String switch Limited operator overloading Improved catch clauses Modularity
  • 23. Improve Diagnostics vs Generics interface Box<T> { T get(); void put(T t); } class Tmp { static void test(Box<? extends Number> box) { box.put(box.get()); } } Error: put(capture#417 of ? extends java.lang.Number) in Box<capture#417 of ? extends java.lang.Number> cannot be applied to (java.lang.Number) box.put(box.get()); ^
  • 24. Improve Diagnostics vs Generics interface Box<T> { T get(); void put(T t); } class Tmp { static void test(Box<? extends Number> box) { box.put(box.get()); } } Error: cannot call put(T) as a member of in Box<? ex- tends java.lang.Number> box.put(box.get()); ^
  • 25. Fix Type Inference: constructors Today: Map<String, List<String>> anagrams = new HashMap<String, List<String>>();
  • 26. Fix Type Inference: constructors Proposed: Map<String, List<String>> anagrams = new HashMap<>();
  • 27. Fix Type Inference: arguments Today: public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // * Won't compile! timeWaitsFor(Collections.emptySet());
  • 28. Fix Type Inference: arguments Today: public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // OK timeWaitsFor(Collections.<Man>emptySet());
  • 29. Fix Type Inference: arguments Proposed: public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // OK timeWaitsFor(Collections.emptySet());
  • 30. String Switch Today static boolean booleanFromString(String s) { if (s.equals(quot;truequot;)) { return true; } else if (s.equals(quot;falsequot;)) { return false; } else { throw new IllegalArgumentException(s); } }
  • 31. String Switch Proposed static boolean booleanFromString(String s) { switch(s) { case quot;truequot;: return true; case quot;falsequot;: return false; default: throw new IllegalArgumentException(s); } }
  • 32. Limited Operator Overloading Today enum Size { SMALL, MEDIUM, LARGE } if (mySize.compareTo(yourSize) >= 0) System.out.println(“You can wear my pants.”);
  • 33. Limited Operator Overloading Proposed enum Size { SMALL, MEDIUM, LARGE } if (mySize > yourSize) System.out.println(“You can wear my pants.”);
  • 34. Improved Catch Clauses: multi Today: try { return klass.newInstance(); } catch (InstantiationException e) { throw new AssertionError(e); } catch (IllegalAccessException e) { throw new AssertionError(e); }
  • 35. Improved Catch Clauses: multi Proposed: try { return klass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new AssertionError(e); }
  • 36. Improved Catch Clauses: rethrow Today: try { doable.doit(); // Throws several types } catch (Throwable ex) { logger.log(ex); throw ex; // Error: Throwable not declared }
  • 37. Improved Catch Clauses: rethrow Proposed: try { doable.doit(); // Throws several types } catch (final Throwable ex) { logger.log(ex); throw ex; // OK: Throws the same several types }
  • 39. Long-term goals Regularize Existing Language Reification Further Generics simplification Concurrency support Immutable data Control Abstraction Closures Actors, etc.
  • 40. JDK7 jsrs 277 + 294 (modularity) Maintenance review of jsr14 “Small” language issues Possibly jsr308 (limited by time, resources)
  • 41. JDK8 Reification Control Abstraction Further out: Immutable data, pattern match- ing, further operator overloading?
  • 42. Q&A