SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Downloaden Sie, um offline zu lesen
8
Stephan Herrmann
Java 8 ready
NPE
Languages
Tools
Innovation
Finding the best leverage
(How) Can I Move It?(How) Can I Move It?
Multiply the Available ForceMultiply the Available Force
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 3
Leverage
●
Software re-shapes the world as we know it
●
Languages shape how we think about software
●
Tools shape how we work with languages
By empowering millions of software developers,
we might indeed “move the world”?
By empowering millions of software developers,
we might indeed “move the world”?
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 4
Agenda
●
Java 8
– supporting innovation in the Java world
●
@NonNull
– bringing quality assurance to the Java world
●
Roles in Object Teams
– extending the Object-Oriented paradigm
●
Domain Specific Languages
– abstractions for sustainable retail applications
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 5
JDT ready for Java 8
●
Eclipse should „support“ Java 8:
●
Compiler should accept and compile Java 8
– analysis (resolve types, detect errors)
– produce class files
●
JDT/UI should support working with Java 8
– visualize
– modify
Java 8 ready
8
2013 / 2014
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 6
Java 8
●
A big step in the evolution of Java!
– λ
– default methods
– type annotations
– library enhancements
– 

8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 7
Compiling λ
●
„Just“ a bit new syntax
8
personList.setLabelProvider(new LabelProvider<Person>() {
public String getLabel(Person p) {
return p.getFullName();
}
});
personList.setLabelProvider(p -> p.getFullName());
personList.setLabelProvider(Person::getFullName);
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 8
λ Backstage
●
Abbreviated code style relies on type inference
●
Challenges
– „guess“ all the types that have been omitted
– deterministic
– no 7Âœ million years Deep Thought pondering
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 9
Prior Art – Aggravated
●
Lambdas are typically arguments to
generic library functions
– public static <T, K, U, M extends Map<K, U>>
Collector<T, ?, M> toMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends U> valueMapper,
BinaryOperator<U> mergeFunction)
●
Would you prefer to call:
– Collectors.<Person,String,Integer,Map<String,Integer>>toMap(..)
●
or:
– Collectors.toMap(..)
●
Similar for instantiation of a generic class (Java 7)
– Collector<String,Integer> coll = new MyCollector<>();
●
How does it work?
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 10
How it works
●
Solving this little example
– Map<String, Integer> test3(Stream<Person> persons) {
return persons.collect(Collectors.toMap(
p -> p.getLastName(),
p -> p.getAge(),
(i1, i2) -> i1+i2));
}
●
Produces these constraints:
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 11
How it works
●
Solving this little example
– Map<String, Integer> test3(Stream<Person> persons) {
return persons.collect(Collectors.toMap(
p -> p.getLastName(),
p -> p.getAge(),
(i1, i2) -> i1+i2));
}
●
Produces these constraints:
TypeBound K#3 :> java.lang.String
Dependency K#3 = K#3
TypeBound K#3 = java.lang.String
TypeBound K#3 <: java.lang.Object
Dependency R#0 = java.util.Map<K#3,U#4>
Dependency R#0 = java.util.Map<java.lang.String,U#4>
Dependency R#0 = java.util.Map<K#3,java.lang.Integer>
TypeBound R#0 = java.util.Map<java.lang.String,java.lang.Integer>
TypeBound R#0 <: java.util.Map<java.lang.String,java.lang.Integer>
TypeBound R#0 <: java.lang.Object
TypeBound T#2 :> Person
Dependency T#2 = T#2
TypeBound T#2 = Person
TypeBound T#2 <: java.lang.Object
Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,U#4>
Dependency Map<K#3,U#4>#6 = java.util.Map<java.lang.String,U#4>
Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,java.lang.Integer>
TypeBound Map<K#3,U#4>#6 = java.util.Map<java.lang.String,java.lang.Integer>
Dependency Map<K#3,U#4>#6 = R#0
TypeBound Map<K#3,U#4>#6 <: java.lang.Object
TypeBound Map<K#3,U#4>#6 <: java.util.Map<java.lang.String,java.lang.Integer>
TypeBound A#1 = java.lang.Object
TypeBound A#1 <: java.lang.Object
TypeBound U#4 :> java.lang.Integer
TypeBound U#4 = java.lang.Integer
Dependency U#4 = U#4
TypeBound U#4 <: java.lang.Object
TypeBound ?#5 = java.lang.Object
Dependency ?#5 = A#1
TypeBound ?#5 <: java.lang.Object
TypeBound K#3 :> java.lang.String
Dependency K#3 = K#3
TypeBound K#3 = java.lang.String
TypeBound K#3 <: java.lang.Object
Dependency R#0 = java.util.Map<K#3,U#4>
Dependency R#0 = java.util.Map<java.lang.String,U#4>
Dependency R#0 = java.util.Map<K#3,java.lang.Integer>
TypeBound R#0 = java.util.Map<java.lang.String,java.lang.Integer>
TypeBound R#0 <: java.util.Map<java.lang.String,java.lang.Integer>
TypeBound R#0 <: java.lang.Object
TypeBound T#2 :> Person
Dependency T#2 = T#2
TypeBound T#2 = Person
TypeBound T#2 <: java.lang.Object
Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,U#4>
Dependency Map<K#3,U#4>#6 = java.util.Map<java.lang.String,U#4>
Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,java.lang.Integer>
TypeBound Map<K#3,U#4>#6 = java.util.Map<java.lang.String,java.lang.Integer>
Dependency Map<K#3,U#4>#6 = R#0
TypeBound Map<K#3,U#4>#6 <: java.lang.Object
TypeBound Map<K#3,U#4>#6 <: java.util.Map<java.lang.String,java.lang.Integer>
TypeBound A#1 = java.lang.Object
TypeBound A#1 <: java.lang.Object
TypeBound U#4 :> java.lang.Integer
TypeBound U#4 = java.lang.Integer
Dependency U#4 = U#4
TypeBound U#4 <: java.lang.Object
TypeBound ?#5 = java.lang.Object
Dependency ?#5 = A#1
TypeBound ?#5 <: java.lang.Object
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 12
Chicken and Egg
●
Type inference
– Infers types of arguments
●
based on a given method signature
●
Overloading
– Selects method
●
e.g., based on types of arguments
<U> void m(Listener<U> l);
<T> void m(Consumer<T> c);


m(a -> print(a));
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 13
Genesis of a new Java Feature
spec
abstractly capture
the concepts
ecj
implement the spec,
the full spec,
and nothing but the spec
deviation
bug?
bug?
bug?
compare behavior
javac
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 14
Take-Away Java 8
●
Second implementation improves quality
●
Java is a Monster
– E.g.: overloading conflicts with type inference ...
– „Orthogonality in Language Design –
Why and how to fake it.“ [Herrmann 2003]
●
ECJ is an enabler
– used by implementations for „working with Java 8“
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 15
Contribution
●
No own invention: Don't interpret!
– No influence on the direction of change
– Some influence on the quality
●
Interact with users / bug reporters
●
Be part of a big step for the Java world
– Acknowledged in the JLS 8 preface 
8
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 16
Quality
●
Quality of Java as a Language
– governed by a specification (JLS)
●
Quality of Java Programs?
– can JDT help developers avoiding problems / bugs?
– which problems?
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 17
Quality
●
Quality of Java as a Language
– governed by a specification (JLS)
●
Quality of Java Programs?
– can JDT help developers avoiding problems / bugs?
– which problems?
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 18
An Old Problem
●
1965
– Tony Hoare introduced Null references in ALGOL W
– “simply because it was so easy to implement”
– “The Billion Dollar Mistake”
PhotographbyRama,WikimediaCommons,Cc-by-sa-2.0-fr
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 19
An Old Problem
●
1965
– Tony Hoare introduced Null references in ALGOL W
– “simply because it was so easy to implement”
– “The Billion Dollar Mistake”
●
Today
– All Java software is threatened by risk of NPE
– Can we bid „bye-bye“ to NPE?
NPE
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 20
2005
1. Flow Analysis
●
Flow Analysis in the Compiler
– needed to check „definite assignment“
– was extended for null information in Eclipse 3.1
– gradually improved ever since
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 21
2005
1. Flow Analysis
●
Flow Analysis in the Compiler
– needed to check „definite assignment“
– was extended for null information in Eclipse 3.1
– gradually improved ever since
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 22
1. Flow Analysis
●
Flow Analysis in the Compiler
– needed to check „definite assignment“
– was extended for null information in Eclipse 3.1
– gradually improved ever since
+1
– high precision
-1
– some warnings can be perceived as „false positives“
– (slightly) incomplete analysis of loops
– no inter procedural analysis!
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 23
1. Flow Analysis
●
Flow Analysis in the Compiler
– needed to check „definite assignment“
– was extended for null information in Eclipse 3.1
– gradually improved ever since
+1
– high precision
-1
– some warnings can be perceived as „false positives“
– (slightly) incomplete analysis of loops
– no inter procedural analysis!
NPE
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 24
2. Null Annotations
●
Use @NonNull and @Nullable
– declare contracts for methods (and fields)
●
Use @NonNullByDefault
– to alleviate the annotation burden
●
(70% of „good API“ are @NonNull by intention)
2012
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 25
2. Null Annotations
●
Use @NonNull and @Nullable
– declare contracts for methods (and fields)
●
Use @NonNullByDefault
– to alleviate the annotation burden
●
(70% of „good API“ are @NonNull by intention)
2012
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 26
2. Null Annotations
●
Use @NonNull and @Nullable
– declare contracts for methods (and fields)
●
Use @NonNullByDefault
– to alleviate the annotation burden
●
(70% of „good API“ are @NonNull by intention)
+1
– detect contract violations
●
definition, usage and specialization
– feed context information into flow analysis
-1
– does not cover: generics (type parameters, type variables)
2012
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 27
2. Null Annotations
●
Use @NonNull and @Nullable
– declare contracts for methods (and fields)
●
Use @NonNullByDefault
– to alleviate the annotation burden
●
(70% of „good API“ are @NonNull by intention)
+1
– detect contract violations
●
definition, usage and specialization
– feed context information into flow analysis
-1
– does not cover: generics (type parameters, type variables)
2012
NPE
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 28
3. Null Type Annotations
●
@NonNull and @Nullable „Everywhere“
– JSR 308: Annotations on Java Types
●
„Make nullness a part of the type system“
Two kinds of types
●
those that include null
●
those that don't
2014
NPE
+1
@Target(ElementType.PARAMETER)
@interface NonNull5 {}
void java5(@NonNull5 String arg);
arg is qualified to be non-null
@Target(ElementType.TYPE_USE)
@interface NonNull8 {}
void java8(@NonNull8 String arg);
String is qualified to be non-null
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 29
3. Null Type Annotations
●
@NonNull and @Nullable „Everywhere“
– JSR 308: Annotations on Java Types
●
„Make nullness a part of the type system“
Two kinds of types
●
those that include null
●
those that don't
2014
NPE
+1
@Target(ElementType.PARAMETER)
@interface NonNull5 {}
void java5(@NonNull5 String arg);
arg is qualified to be non-null
@Target(ElementType.TYPE_USE)
@interface NonNull8 {}
void java8(@NonNull8 String arg);
String is qualified to be non-null
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 30
NPE
3. Null Type Annotations
●
@NonNull and @Nullable „Everywhere“ 2014
NPE
+1
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 31
NPE
3. Null Type Annotations
●
@NonNull and @Nullable „Everywhere“ 2014
NPE
+1
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 32
4. External Annotations
●
Attach annotations to libraries 2015
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 33
4. External Annotations
●
Attach annotations to libraries 2015
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 34
4. External Annotations
●
The bad news:
– No more excuse
– You've got some home work to do
●
Existing code:
– who is responsible for handling null?
– recover design that probably has decayed?
●
New code:
– start by saying @NonNullByDefault
– always be explicit about null (or avoid it)
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 35
Contribution
●
Not the only tool for null analysis
●
But the most complete main-stream solution
– to the tiniest, most embarrassing problem in Java
NPE
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 36
Paradigm Shift?
●
Paradigms connect ...
– metaphors (intuition)
– technical solution (precise semantics)
●
„Languages shape how we think about software“
– null annotations
●
not a paradigm
– functional programming
●
the shift happened before my time
●
Object-oriented programming
– a paradigm shift in the 1980s
– is this the end of evolution?
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 37
Reconsider Inheritance
+1
– Derive a new concept from an existing one
– Describe only the differences
– May coincide with subtyping
-1
– Doesn't scale
– Cannot model changes over time
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 38
Scale
Player Token
Move Rule validate(Move m)
Player Token
Move Rule validate(Move m)
BoardGame
Chess
≙ Chess.Move
≙ BoardGame.Move
Token
Move Rule
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 39
Introducing Object Teams
●
team class Chess
– package (namespace) & class (instances)
●
team class Chess extends BoardGame
– aka Family Polymorphism
●
propagating specialization
●
typesafe covariance
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 40
Change
Person
name
Employee
salary
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 41
Change
●
Properties
– Dynamism:
roles can come and go
(same base object)
– Multiplicities:
one base can play several roles
(different/same role types)
playedBy Relationship
Person
name
Employee
salary
«playedBy»
name=”joe”
joe: Person
:Student
matr=0815
«base»
:Employee
salary=100
«base»
:Employee
salary=2000
«base»
Employee
salary
Role Base
Person
name
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 42
Introducing Object Teams
●
team class Chess
– package (namespace) & class (instances)
●
team class Chess extends BoardGame
– aka Family Polymorphism
●
class Student playedBy Person
– „inheritance“ among instances
●
sharing of common properties
●
overriding
Arbitrary mix of language features?
Synergy?
Arbitrary mix of language features?
Synergy?
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 43
Roles & Teams
●
Roles depend on context
– contexts are reified as Teams
●
Each team instance can be (de)activated
– active team instances contribute to the system state
– dispatch considers system state
:Person
phoneNo
getPhoneNo()
c :Companyc :Company
name
hire(Person p)
name
hire(Person p)
:Employee
officePhoneNo
getPhoneNo ← getPhoneNo
«playedBy»
getPhoneNo()
Off On
if (c.isActive())
getPhoneNo()
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 44
Contribution
●
Ingredients
– years of research (since 1999)
– years of engineering
– new paradigm?
●
powerful new metaphors
●
precise underpinning
●
Move the world?
– big step
– few adopters
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 45
SIMPLY RETAIL
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 46
Goals
●
Separation of concerns 

– 
 can we identify the pure business logic?
– 
 how do you port your app to a new platform?
●
Software product line
– Many mechanisms to offer extensibility
– Shortage of extensibility on demand
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 47
Business Logic
●
Domain Objects
– Entities
●
attributes
●
references
●
Flow / Processes
– States / Steps
– Transitions
●
event
●
condition
●
action
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 48
Domain Specific Languages
●
Textual modeling languages (9)
– syntax
●
grammar
– semantics
●
name resolution, validation
– IDE functions
●
navigation, outline, search, hover, quick fix, 

●
Separate but connected
– Inter-language integration
– Diagrams are derived
– Light-weight documentation
●
tightly integrated with Mylyn WikiText
Mix-n-match plug-in integration
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 49
Separate, but Connected
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 50
Safe for any Future
●
Generate source code
– for new target platforms
●
Interpret models @ runtime
– cool for monitoring, debugging 

●
Migrate existing models
– to new versions of the language
●
Thanks to EMF underpinning!
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 51
Draw from Experience
●
Full type checking
– all types are nonnull by default
– optional types are marked, e.g., Item?
●
Customization on demand
– all models can be specialized
– propagating specialization
Player Token
Move Rule
Player Token
Move Rule
BoardGame
Chess
Token
Move Rule
NPE
Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 52
Move the World?
spec
ecjjavac
It's the taking part that counts
Resolving the tiniest,
most embarrassing problem in Java
Big progress,
at a low multiplication factor.
Mix-n-match paradigm shift,
for one mid-sized company.
NPE

Weitere Àhnliche Inhalte

Andere mochten auch

Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...
Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...
Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...
Dimitris Dranidis
 
Swift and Kotlin Presentation
Swift and Kotlin PresentationSwift and Kotlin Presentation
Swift and Kotlin Presentation
Andrzej Sitek
 
An Empirical Study of Goto in C Code from GitHub Repositories
An Empirical Study of Goto in C Code from GitHub RepositoriesAn Empirical Study of Goto in C Code from GitHub Repositories
An Empirical Study of Goto in C Code from GitHub Repositories
SAIL_QU
 
Software reliability engineering
Software reliability engineeringSoftware reliability engineering
Software reliability engineering
Mark Turner CRP
 

Andere mochten auch (11)

Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...
Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...
Get Ready for Agile Methods: How to manage constant and rapid change in IT pr...
 
Get Functional on the CLR: Intro to Functional Programming with F#
Get Functional on the CLR: Intro to Functional Programming with F# Get Functional on the CLR: Intro to Functional Programming with F#
Get Functional on the CLR: Intro to Functional Programming with F#
 
No silver bullet
No silver bulletNo silver bullet
No silver bullet
 
No silver bullet essence and accidents of software engineering
No silver bullet essence and accidents of software engineeringNo silver bullet essence and accidents of software engineering
No silver bullet essence and accidents of software engineering
 
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinC# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
 
Swift and Kotlin Presentation
Swift and Kotlin PresentationSwift and Kotlin Presentation
Swift and Kotlin Presentation
 
An Empirical Study of Goto in C Code from GitHub Repositories
An Empirical Study of Goto in C Code from GitHub RepositoriesAn Empirical Study of Goto in C Code from GitHub Repositories
An Empirical Study of Goto in C Code from GitHub Repositories
 
Software reliability engineering
Software reliability engineeringSoftware reliability engineering
Software reliability engineering
 
Chapter 7 software reliability
Chapter 7 software reliabilityChapter 7 software reliability
Chapter 7 software reliability
 
Agile Is the New Waterfall
Agile Is the New WaterfallAgile Is the New Waterfall
Agile Is the New Waterfall
 
Kotlin
KotlinKotlin
Kotlin
 

Ähnlich wie Eclipse Day India 2015 - Keynote - Stephan Herrmann

Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
Apache OpenNLP
 

Ähnlich wie Eclipse Day India 2015 - Keynote - Stephan Herrmann (20)

About programming languages
About programming languagesAbout programming languages
About programming languages
 
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
 
A Preliminary Field Study of Game Programming on Mobile Devices
A Preliminary Field Study of Game Programming on Mobile DevicesA Preliminary Field Study of Game Programming on Mobile Devices
A Preliminary Field Study of Game Programming on Mobile Devices
 
The 10 Commandments of Building Global Software
The 10 Commandments of Building Global SoftwareThe 10 Commandments of Building Global Software
The 10 Commandments of Building Global Software
 
Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?
 
History Of C Essay
History Of C EssayHistory Of C Essay
History Of C Essay
 
ESWC-2011: S-Match received 7 years award
ESWC-2011: S-Match received 7 years award ESWC-2011: S-Match received 7 years award
ESWC-2011: S-Match received 7 years award
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 
The *on-going* future of Perl5
The *on-going* future of Perl5The *on-going* future of Perl5
The *on-going* future of Perl5
 
Seven Thinking Tools to Test Rapidly
Seven Thinking Tools to Test RapidlySeven Thinking Tools to Test Rapidly
Seven Thinking Tools to Test Rapidly
 
Elasticsearch Basics
Elasticsearch BasicsElasticsearch Basics
Elasticsearch Basics
 
The Ring programming language version 1.5.2 book - Part 5 of 181
The Ring programming language version 1.5.2 book - Part 5 of 181The Ring programming language version 1.5.2 book - Part 5 of 181
The Ring programming language version 1.5.2 book - Part 5 of 181
 
Profiling & Performance for Fun and Profit
Profiling & Performance for Fun and ProfitProfiling & Performance for Fun and Profit
Profiling & Performance for Fun and Profit
 
Analyzing the Eclipse API Usage: Putting the Developer in the Loop
Analyzing the Eclipse API Usage: Putting the Developer in the LoopAnalyzing the Eclipse API Usage: Putting the Developer in the Loop
Analyzing the Eclipse API Usage: Putting the Developer in the Loop
 
Code, ci, infrastructure - the gophers way
Code, ci, infrastructure - the gophers wayCode, ci, infrastructure - the gophers way
Code, ci, infrastructure - the gophers way
 
Designing Object Oriented Software - lecture slides 2013
Designing Object Oriented Software - lecture slides 2013Designing Object Oriented Software - lecture slides 2013
Designing Object Oriented Software - lecture slides 2013
 
TDC 2020 - Implementing a Mini-Language
TDC 2020 - Implementing a Mini-LanguageTDC 2020 - Implementing a Mini-Language
TDC 2020 - Implementing a Mini-Language
 
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
 

Mehr von Eclipse Day India

Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...
Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...
Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...
Eclipse Day India
 
Supporting Javaℱ 9 in Eclipse - A critical perspective - Stephan Herrmann
Supporting Javaℱ 9 in Eclipse - A critical perspective - Stephan HerrmannSupporting Javaℱ 9 in Eclipse - A critical perspective - Stephan Herrmann
Supporting Javaℱ 9 in Eclipse - A critical perspective - Stephan Herrmann
Eclipse Day India
 

Mehr von Eclipse Day India (20)

Java Performance Testing for Everyone - Shelley Lambert
Java Performance Testing for Everyone - Shelley LambertJava Performance Testing for Everyone - Shelley Lambert
Java Performance Testing for Everyone - Shelley Lambert
 
Eclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
Eclipse IDE Tips and Tricks - Lakshmi Priya ShanmugamEclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
Eclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
 
Pattern Matching in Java - Srikanth Sankaran
Pattern Matching in Java - Srikanth SankaranPattern Matching in Java - Srikanth Sankaran
Pattern Matching in Java - Srikanth Sankaran
 
Machine Learning for Java Developers - Nasser Ebrahim
Machine Learning for Java Developers - Nasser EbrahimMachine Learning for Java Developers - Nasser Ebrahim
Machine Learning for Java Developers - Nasser Ebrahim
 
Scaling Eclipse on HiDPI Monitors - Niraj Modi
Scaling Eclipse on HiDPI Monitors - Niraj ModiScaling Eclipse on HiDPI Monitors - Niraj Modi
Scaling Eclipse on HiDPI Monitors - Niraj Modi
 
Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...
Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...
Please Behave Yourself: BDD and automating Eclipse RCP applications using JBe...
 
Supporting Javaℱ 9 in Eclipse - A critical perspective - Stephan Herrmann
Supporting Javaℱ 9 in Eclipse - A critical perspective - Stephan HerrmannSupporting Javaℱ 9 in Eclipse - A critical perspective - Stephan Herrmann
Supporting Javaℱ 9 in Eclipse - A critical perspective - Stephan Herrmann
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
 
Eclipse Day India 2015 - Java bytecode analysis and JIT
Eclipse Day India 2015 - Java bytecode analysis and JITEclipse Day India 2015 - Java bytecode analysis and JIT
Eclipse Day India 2015 - Java bytecode analysis and JIT
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
 
Eclipse Day India 2015 - Java 9
Eclipse Day India 2015 - Java 9Eclipse Day India 2015 - Java 9
Eclipse Day India 2015 - Java 9
 
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automationEclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
 
Eclipse Day India 2015 - Oomph
Eclipse Day India 2015 - OomphEclipse Day India 2015 - Oomph
Eclipse Day India 2015 - Oomph
 
Eclipse Day India 2015 - Keynote (Mike Milinkovich)
Eclipse Day India 2015 - Keynote (Mike Milinkovich)Eclipse Day India 2015 - Keynote (Mike Milinkovich)
Eclipse Day India 2015 - Keynote (Mike Milinkovich)
 
Eclipse Day India 2015 - Unleashing the Java 8 Tooling in Eclipse
Eclipse Day India 2015 - Unleashing the Java 8 Tooling in EclipseEclipse Day India 2015 - Unleashing the Java 8 Tooling in Eclipse
Eclipse Day India 2015 - Unleashing the Java 8 Tooling in Eclipse
 
IDS and Bluemix
IDS and BluemixIDS and Bluemix
IDS and Bluemix
 
SWT - Technical Deep Dive
SWT - Technical Deep DiveSWT - Technical Deep Dive
SWT - Technical Deep Dive
 
PDE builds or Maven
PDE builds or MavenPDE builds or Maven
PDE builds or Maven
 
Orion - IDE on the cloud
Orion - IDE on the cloudOrion - IDE on the cloud
Orion - IDE on the cloud
 
KlighD
KlighDKlighD
KlighD
 

KĂŒrzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
 

KĂŒrzlich hochgeladen (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Eclipse Day India 2015 - Keynote - Stephan Herrmann

  • 1. 8 Stephan Herrmann Java 8 ready NPE Languages Tools Innovation
  • 2. Finding the best leverage (How) Can I Move It?(How) Can I Move It? Multiply the Available ForceMultiply the Available Force
  • 3. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 3 Leverage ● Software re-shapes the world as we know it ● Languages shape how we think about software ● Tools shape how we work with languages By empowering millions of software developers, we might indeed “move the world”? By empowering millions of software developers, we might indeed “move the world”?
  • 4. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 4 Agenda ● Java 8 – supporting innovation in the Java world ● @NonNull – bringing quality assurance to the Java world ● Roles in Object Teams – extending the Object-Oriented paradigm ● Domain Specific Languages – abstractions for sustainable retail applications
  • 5. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 5 JDT ready for Java 8 ● Eclipse should „support“ Java 8: ● Compiler should accept and compile Java 8 – analysis (resolve types, detect errors) – produce class files ● JDT/UI should support working with Java 8 – visualize – modify Java 8 ready 8 2013 / 2014
  • 6. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 6 Java 8 ● A big step in the evolution of Java! – λ – default methods – type annotations – library enhancements – 
 8
  • 7. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 7 Compiling λ ● „Just“ a bit new syntax 8 personList.setLabelProvider(new LabelProvider<Person>() { public String getLabel(Person p) { return p.getFullName(); } }); personList.setLabelProvider(p -> p.getFullName()); personList.setLabelProvider(Person::getFullName);
  • 8. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 8 λ Backstage ● Abbreviated code style relies on type inference ● Challenges – „guess“ all the types that have been omitted – deterministic – no 7Âœ million years Deep Thought pondering 8
  • 9. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 9 Prior Art – Aggravated ● Lambdas are typically arguments to generic library functions – public static <T, K, U, M extends Map<K, U>> Collector<T, ?, M> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends U> valueMapper, BinaryOperator<U> mergeFunction) ● Would you prefer to call: – Collectors.<Person,String,Integer,Map<String,Integer>>toMap(..) ● or: – Collectors.toMap(..) ● Similar for instantiation of a generic class (Java 7) – Collector<String,Integer> coll = new MyCollector<>(); ● How does it work? 8
  • 10. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 10 How it works ● Solving this little example – Map<String, Integer> test3(Stream<Person> persons) { return persons.collect(Collectors.toMap( p -> p.getLastName(), p -> p.getAge(), (i1, i2) -> i1+i2)); } ● Produces these constraints: 8
  • 11. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 11 How it works ● Solving this little example – Map<String, Integer> test3(Stream<Person> persons) { return persons.collect(Collectors.toMap( p -> p.getLastName(), p -> p.getAge(), (i1, i2) -> i1+i2)); } ● Produces these constraints: TypeBound K#3 :> java.lang.String Dependency K#3 = K#3 TypeBound K#3 = java.lang.String TypeBound K#3 <: java.lang.Object Dependency R#0 = java.util.Map<K#3,U#4> Dependency R#0 = java.util.Map<java.lang.String,U#4> Dependency R#0 = java.util.Map<K#3,java.lang.Integer> TypeBound R#0 = java.util.Map<java.lang.String,java.lang.Integer> TypeBound R#0 <: java.util.Map<java.lang.String,java.lang.Integer> TypeBound R#0 <: java.lang.Object TypeBound T#2 :> Person Dependency T#2 = T#2 TypeBound T#2 = Person TypeBound T#2 <: java.lang.Object Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,U#4> Dependency Map<K#3,U#4>#6 = java.util.Map<java.lang.String,U#4> Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,java.lang.Integer> TypeBound Map<K#3,U#4>#6 = java.util.Map<java.lang.String,java.lang.Integer> Dependency Map<K#3,U#4>#6 = R#0 TypeBound Map<K#3,U#4>#6 <: java.lang.Object TypeBound Map<K#3,U#4>#6 <: java.util.Map<java.lang.String,java.lang.Integer> TypeBound A#1 = java.lang.Object TypeBound A#1 <: java.lang.Object TypeBound U#4 :> java.lang.Integer TypeBound U#4 = java.lang.Integer Dependency U#4 = U#4 TypeBound U#4 <: java.lang.Object TypeBound ?#5 = java.lang.Object Dependency ?#5 = A#1 TypeBound ?#5 <: java.lang.Object TypeBound K#3 :> java.lang.String Dependency K#3 = K#3 TypeBound K#3 = java.lang.String TypeBound K#3 <: java.lang.Object Dependency R#0 = java.util.Map<K#3,U#4> Dependency R#0 = java.util.Map<java.lang.String,U#4> Dependency R#0 = java.util.Map<K#3,java.lang.Integer> TypeBound R#0 = java.util.Map<java.lang.String,java.lang.Integer> TypeBound R#0 <: java.util.Map<java.lang.String,java.lang.Integer> TypeBound R#0 <: java.lang.Object TypeBound T#2 :> Person Dependency T#2 = T#2 TypeBound T#2 = Person TypeBound T#2 <: java.lang.Object Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,U#4> Dependency Map<K#3,U#4>#6 = java.util.Map<java.lang.String,U#4> Dependency Map<K#3,U#4>#6 = java.util.Map<K#3,java.lang.Integer> TypeBound Map<K#3,U#4>#6 = java.util.Map<java.lang.String,java.lang.Integer> Dependency Map<K#3,U#4>#6 = R#0 TypeBound Map<K#3,U#4>#6 <: java.lang.Object TypeBound Map<K#3,U#4>#6 <: java.util.Map<java.lang.String,java.lang.Integer> TypeBound A#1 = java.lang.Object TypeBound A#1 <: java.lang.Object TypeBound U#4 :> java.lang.Integer TypeBound U#4 = java.lang.Integer Dependency U#4 = U#4 TypeBound U#4 <: java.lang.Object TypeBound ?#5 = java.lang.Object Dependency ?#5 = A#1 TypeBound ?#5 <: java.lang.Object 8
  • 12. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 12 Chicken and Egg ● Type inference – Infers types of arguments ● based on a given method signature ● Overloading – Selects method ● e.g., based on types of arguments <U> void m(Listener<U> l); <T> void m(Consumer<T> c); 
 m(a -> print(a));
  • 13. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 13 Genesis of a new Java Feature spec abstractly capture the concepts ecj implement the spec, the full spec, and nothing but the spec deviation bug? bug? bug? compare behavior javac 8
  • 14. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 14 Take-Away Java 8 ● Second implementation improves quality ● Java is a Monster – E.g.: overloading conflicts with type inference ... – „Orthogonality in Language Design – Why and how to fake it.“ [Herrmann 2003] ● ECJ is an enabler – used by implementations for „working with Java 8“ 8
  • 15. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 15 Contribution ● No own invention: Don't interpret! – No influence on the direction of change – Some influence on the quality ● Interact with users / bug reporters ● Be part of a big step for the Java world – Acknowledged in the JLS 8 preface  8
  • 16. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 16 Quality ● Quality of Java as a Language – governed by a specification (JLS) ● Quality of Java Programs? – can JDT help developers avoiding problems / bugs? – which problems?
  • 17. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 17 Quality ● Quality of Java as a Language – governed by a specification (JLS) ● Quality of Java Programs? – can JDT help developers avoiding problems / bugs? – which problems?
  • 18. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 18 An Old Problem ● 1965 – Tony Hoare introduced Null references in ALGOL W – “simply because it was so easy to implement” – “The Billion Dollar Mistake” PhotographbyRama,WikimediaCommons,Cc-by-sa-2.0-fr
  • 19. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 19 An Old Problem ● 1965 – Tony Hoare introduced Null references in ALGOL W – “simply because it was so easy to implement” – “The Billion Dollar Mistake” ● Today – All Java software is threatened by risk of NPE – Can we bid „bye-bye“ to NPE? NPE NPE
  • 20. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 20 2005 1. Flow Analysis ● Flow Analysis in the Compiler – needed to check „definite assignment“ – was extended for null information in Eclipse 3.1 – gradually improved ever since NPE
  • 21. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 21 2005 1. Flow Analysis ● Flow Analysis in the Compiler – needed to check „definite assignment“ – was extended for null information in Eclipse 3.1 – gradually improved ever since NPE
  • 22. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 22 1. Flow Analysis ● Flow Analysis in the Compiler – needed to check „definite assignment“ – was extended for null information in Eclipse 3.1 – gradually improved ever since +1 – high precision -1 – some warnings can be perceived as „false positives“ – (slightly) incomplete analysis of loops – no inter procedural analysis! NPE
  • 23. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 23 1. Flow Analysis ● Flow Analysis in the Compiler – needed to check „definite assignment“ – was extended for null information in Eclipse 3.1 – gradually improved ever since +1 – high precision -1 – some warnings can be perceived as „false positives“ – (slightly) incomplete analysis of loops – no inter procedural analysis! NPE NPE
  • 24. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 24 2. Null Annotations ● Use @NonNull and @Nullable – declare contracts for methods (and fields) ● Use @NonNullByDefault – to alleviate the annotation burden ● (70% of „good API“ are @NonNull by intention) 2012 NPE
  • 25. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 25 2. Null Annotations ● Use @NonNull and @Nullable – declare contracts for methods (and fields) ● Use @NonNullByDefault – to alleviate the annotation burden ● (70% of „good API“ are @NonNull by intention) 2012 NPE
  • 26. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 26 2. Null Annotations ● Use @NonNull and @Nullable – declare contracts for methods (and fields) ● Use @NonNullByDefault – to alleviate the annotation burden ● (70% of „good API“ are @NonNull by intention) +1 – detect contract violations ● definition, usage and specialization – feed context information into flow analysis -1 – does not cover: generics (type parameters, type variables) 2012 NPE
  • 27. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 27 2. Null Annotations ● Use @NonNull and @Nullable – declare contracts for methods (and fields) ● Use @NonNullByDefault – to alleviate the annotation burden ● (70% of „good API“ are @NonNull by intention) +1 – detect contract violations ● definition, usage and specialization – feed context information into flow analysis -1 – does not cover: generics (type parameters, type variables) 2012 NPE NPE
  • 28. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 28 3. Null Type Annotations ● @NonNull and @Nullable „Everywhere“ – JSR 308: Annotations on Java Types ● „Make nullness a part of the type system“ Two kinds of types ● those that include null ● those that don't 2014 NPE +1 @Target(ElementType.PARAMETER) @interface NonNull5 {} void java5(@NonNull5 String arg); arg is qualified to be non-null @Target(ElementType.TYPE_USE) @interface NonNull8 {} void java8(@NonNull8 String arg); String is qualified to be non-null
  • 29. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 29 3. Null Type Annotations ● @NonNull and @Nullable „Everywhere“ – JSR 308: Annotations on Java Types ● „Make nullness a part of the type system“ Two kinds of types ● those that include null ● those that don't 2014 NPE +1 @Target(ElementType.PARAMETER) @interface NonNull5 {} void java5(@NonNull5 String arg); arg is qualified to be non-null @Target(ElementType.TYPE_USE) @interface NonNull8 {} void java8(@NonNull8 String arg); String is qualified to be non-null
  • 30. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 30 NPE 3. Null Type Annotations ● @NonNull and @Nullable „Everywhere“ 2014 NPE +1
  • 31. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 31 NPE 3. Null Type Annotations ● @NonNull and @Nullable „Everywhere“ 2014 NPE +1
  • 32. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 32 4. External Annotations ● Attach annotations to libraries 2015 NPE
  • 33. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 33 4. External Annotations ● Attach annotations to libraries 2015 NPE
  • 34. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 34 4. External Annotations ● The bad news: – No more excuse – You've got some home work to do ● Existing code: – who is responsible for handling null? – recover design that probably has decayed? ● New code: – start by saying @NonNullByDefault – always be explicit about null (or avoid it) NPE
  • 35. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 35 Contribution ● Not the only tool for null analysis ● But the most complete main-stream solution – to the tiniest, most embarrassing problem in Java NPE NPE
  • 36. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 36 Paradigm Shift? ● Paradigms connect ... – metaphors (intuition) – technical solution (precise semantics) ● „Languages shape how we think about software“ – null annotations ● not a paradigm – functional programming ● the shift happened before my time ● Object-oriented programming – a paradigm shift in the 1980s – is this the end of evolution?
  • 37. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 37 Reconsider Inheritance +1 – Derive a new concept from an existing one – Describe only the differences – May coincide with subtyping -1 – Doesn't scale – Cannot model changes over time
  • 38. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 38 Scale Player Token Move Rule validate(Move m) Player Token Move Rule validate(Move m) BoardGame Chess ≙ Chess.Move ≙ BoardGame.Move Token Move Rule
  • 39. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 39 Introducing Object Teams ● team class Chess – package (namespace) & class (instances) ● team class Chess extends BoardGame – aka Family Polymorphism ● propagating specialization ● typesafe covariance
  • 40. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 40 Change Person name Employee salary
  • 41. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 41 Change ● Properties – Dynamism: roles can come and go (same base object) – Multiplicities: one base can play several roles (different/same role types) playedBy Relationship Person name Employee salary «playedBy» name=”joe” joe: Person :Student matr=0815 «base» :Employee salary=100 «base» :Employee salary=2000 «base» Employee salary Role Base Person name
  • 42. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 42 Introducing Object Teams ● team class Chess – package (namespace) & class (instances) ● team class Chess extends BoardGame – aka Family Polymorphism ● class Student playedBy Person – „inheritance“ among instances ● sharing of common properties ● overriding Arbitrary mix of language features? Synergy? Arbitrary mix of language features? Synergy?
  • 43. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 43 Roles & Teams ● Roles depend on context – contexts are reified as Teams ● Each team instance can be (de)activated – active team instances contribute to the system state – dispatch considers system state :Person phoneNo getPhoneNo() c :Companyc :Company name hire(Person p) name hire(Person p) :Employee officePhoneNo getPhoneNo ← getPhoneNo «playedBy» getPhoneNo() Off On if (c.isActive()) getPhoneNo()
  • 44. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 44 Contribution ● Ingredients – years of research (since 1999) – years of engineering – new paradigm? ● powerful new metaphors ● precise underpinning ● Move the world? – big step – few adopters
  • 45. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 45 SIMPLY RETAIL
  • 46. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 46 Goals ● Separation of concerns 
 – 
 can we identify the pure business logic? – 
 how do you port your app to a new platform? ● Software product line – Many mechanisms to offer extensibility – Shortage of extensibility on demand
  • 47. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 47 Business Logic ● Domain Objects – Entities ● attributes ● references ● Flow / Processes – States / Steps – Transitions ● event ● condition ● action
  • 48. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 48 Domain Specific Languages ● Textual modeling languages (9) – syntax ● grammar – semantics ● name resolution, validation – IDE functions ● navigation, outline, search, hover, quick fix, 
 ● Separate but connected – Inter-language integration – Diagrams are derived – Light-weight documentation ● tightly integrated with Mylyn WikiText Mix-n-match plug-in integration
  • 49. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 49 Separate, but Connected
  • 50. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 50 Safe for any Future ● Generate source code – for new target platforms ● Interpret models @ runtime – cool for monitoring, debugging 
 ● Migrate existing models – to new versions of the language ● Thanks to EMF underpinning!
  • 51. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 51 Draw from Experience ● Full type checking – all types are nonnull by default – optional types are marked, e.g., Item? ● Customization on demand – all models can be specialized – propagating specialization Player Token Move Rule Player Token Move Rule BoardGame Chess Token Move Rule NPE
  • 52. Stephan Herrmann: Innovation through languages and tools? - Eclipse Day India 2015 # 52 Move the World? spec ecjjavac It's the taking part that counts Resolving the tiniest, most embarrassing problem in Java Big progress, at a low multiplication factor. Mix-n-match paradigm shift, for one mid-sized company. NPE