I hope you already figured out the "why" question. Let me help you with the "how".
We all have this PO/PM/CFO/boss (delete where inapplicable) that will ask us about the business impact:
- Will it let us deliver the business features faster?
- Will we gain a competitive edge?
- Is it a kind of one-off task?
- How much does it cost?
We might hate to answer these "trivial" questions, but they are all valid. After all, we pick the tools to serve the purpose, not the other way around…
In this session, I would like to present the approach IDEMIA took to upgrade any critical dependencies in our platforms. There is always some risk involved, but we have tools and practices that help us mitigate the issues, measure the impact and foresee potential consequences before they happen.
6. 1
6
Code
Compiles
jig·saw [jig-saw] n.
a complicated problem consisting of many
different parts
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
7. There are no silver bullets
A lot of libraries or plugins are not compatible with Java 9 yet
7
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
12. JEP 302: Lambda Leftovers
Treatment of underscores
In many languages, it is common to use an underscore (_) to denote an unnamed
lambda parameter (and similarly for method and exception parameters):
(…)
Phase 2 came in Java 9, when this warning became an error.
12
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
BiFunction<Integer, String, String> biss = (i, _) -> String.valueOf(i);
13. Sonar to the rescue!™
13
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
14. Yet another tool to cope with?
14
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
16. 3
16
New feature merged
to the master branch
Things might fail or
they might not fail
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
17. Enhanced Collections framework
static <K,V> Map<K,V> of()
static <K,V> Map<K,V> of(K k1, V v1)
static <K,V> Map<K,V> of(K k1, V v1, K k2, V v2)
static <K,V> Map<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3)
static <K,V> Map<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5,
K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10)
static <K,V> Map<K,V> ofEntries(Map.Entry<? extends K,? extends V>... entries)
17
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
Map<String, Integer> fooBar = Map.ofEntries(
entry("foo", 1),
entry("bar", 2),
// (...)
entry("baz", 42));
22. 4
22
All tests pass
Things might fail…
but they also might not fail
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
23. OptUtils
/** @return ofNullable(t).map(provider).orElseGet(supplier) */
public static <T, R> R optGet(
T t,
Function<T, R> provider,
Supplier<R> supplier) {
return ofNullable(t).map(provider).orElseGet(supplier);
}
23
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
24. You can “unit” test your performance
@Test
public void testPerf() throws Exception {
Result result = benchmark(4, 1000,
(thread, pass) -> singlePass(thread, pass));
LOG.info(Table.print(result));
assertExecTimes(result);
}
24
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
25. Ugly? But it’s up to 10x faster…
/** @return ofNullable(t).map(provider).orElseGet(supplier) */
public static <T, R> R optGet(
T t,
Function<T, R> provider,
Supplier<R> supplier) {
return t == null ?
supplier.get() :
optGet(provider.apply(t), supplier);
}
/** @return ofNullable(t).orElseGet(supplier) */
public static <T> T optGet(T t, Supplier<T> supplier) {
return t == null ? supplier.get() : t;
}
25
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
26. 5
26
The task is documented
and closed
In case you just woke up…
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017
27. Brace yourself
Java WILL be updated every 6 months. Make sure you’re armed and ready
27
Confidential/Restricted/Public
Presentationorparttitle
13/11/2017