28
Trends in development with Java

Java trends

Embed Size (px)

Citation preview

Trends in development with Java

@emeuter

@emeuter

Roger’s bell curve in correct scale

Our focus

@emeuter

Java 8

@emeuter

Java language principles

• Simplicity matters

• Reading is more important than writing

• One language: with the same meaning everywhere

Keynote JavaOne, 2014

@emeuter

Highlights Java 8

• Lambda’s

• JSR 310: Date and Time API

• Nashorn: Javascript interoperability

• JavaFX: Enhancements

@emeuter

List<Developer> sortAndFilterDevelopersJavaEE(

Collection<Developer> javaCommunity){

List<Developer> result = new ArrayList<>();

for(Developer duke : javaCommunity){

if(duke.skillSet.contains(Skill.JAVA_EE);

result.add(duke)

}

Collections.sort(result, new Comparator<Developer>(){

@Override

public int compare(Developer d1, Developer d2){

return d1.name.compareTo(d2.name);

}

});

return result;

}

@emeuter

List<Developer> sortAndFilterDevelopersJavaEE(

Collection<Developer> javaCommunity){

return javaCommunity.stream()

.filter(duke ->duke.skillSet.contains(Skill.JAVA_EE))

.sorted((Comparator.comparing(duke -> duke.name))

.collect(Collectors.toList());

}

@emeuter

import java.io.IOException;

import java.nio.file.*;

public static void main(String[] args) throws IOException {

String content =

new String(Files.readAllBytes(Paths.get("duke.java")));

}

@emeuter

StringJoiner sj = new StringJoiner(":", "[", "]");

sj.add("George").add("Sally").add("Fred");

System.out.println(sj.toString());

[George:Sally:Fred]

@emeuter

Nashorn: Javascript on the JVM

• Rationale

• Project Avatar

• Scripting languages

• Improved integration

@emeuter

Beyond Java 8

@emeuter

Project Jigsaw… finally?

• Modularise the JRE

• No more rt.jar and tools.jar

@emeuter

class Point{

int x;

int y;

}

Point[] arrayOfPoints;

@emeuter

class Point{

int x;

int y;

}

Point[] arrayOfPoints; Header

Point_0

Point_1

Header

x

y

Header

x

y

@emeuter

value class Point{

int x;

int y;

}

@emeuter

value class Point{

int x;

int y;

}

Point[] arrayOfPoints; Header

Point_0.x

Point_0.y

Point_1.x

Point_1.y

@emeuter

What ever the result my be…

Test today!

@emeuter

Software must add value to the business

@emeuter

Seems to be difficult…

• Big, monolith applications

• Culture that is focussed on IT procedures

• Heterogenic application landscape

• Failing communication

@emeuter

Business capability

+ Modularity

= Micro services

@emeuter

Trust your automated tests

@emeuter

Gain trust with mutant testing

Your code

Mutated code

Your tests …

Mutant killed: Proper test

Mutant lives: Buggy test

fail

succeed Make a small

change test

x = 1 + 2 x = 1 / 2 assertThat(x, is(2))

Mutant killed your code. Oops…

die

@emeuter

REST can be beautiful

@emeuter

• HTTP protocol

– Use the appropriate method: favour POST over PUT

– Use correct HTTP status codes

– Use the header

– URLs are essential

• JSON: Use Javascript conventions

@emeuter

Docker

@emeuter

@emeuter

Questions?