You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Live demo on Spring reactive code (spring.web.reactive)
Using Inside-out TDD
Http mocking via WireMock
Contract tests (exposed by producer, used by client)
Good Old Stream API, by Tagir Valeev
Cf. Stremex (OOS, extends Java Streams)
source -> intermediate operations -> terminal operations (sinks)
Source
=====
Make our own streams
With indices?
Zip to combine two lists
Fail or not if size differ
Cartesian product
via flatMap ? Not elegant
via String Supplier + reduce + flatMap
Intermediate ops
===========
filter elements of given type: flatMap FTW!
keep elements that appear 3 times or more: collect(groupingBy()).removeIf()?
process adjacent elements: parallelStream? (no, order is not garanted) via PairMapSpliterator (cf. SplitIteraror)
Terminal ops
============
combine list of maps into a single map: flatMap + collect(groupBy)?
Sort elements (by size)
Collector issues
==
- combiner associativiy required
- no short-circuit on collectors
check if all elements are unique: allMatch
calculate the string hashcode:
not possible with parallel stream (reduce is associative)?
Life Beyond Java 8, by Trisha Gee
LTS / intermediate versions
Jshell:
exploration FTW!
/vars /methods
Var:
not everywhere! (see openJDK best practices)
to prevent type repetition
to hide complicated types with generics etc.
Collection factories
unmodifiable collections via List.of()
unmodifiable sets via Set.of()
unmodifiable maps via Map.ofEntries() or Map.of(kvs)
Streams
Collectors.toUnmodifiableList()
Stream#takeWhile()
Predicate.not()
Optional
isEmpty()
orElseThrow()
ifPresentOrElse()
or() // or other optional
stream()
Built-in HTTP client
Multi release JAR files
for libraries (Java 8 JAR + Java 9 JAR etc), less useful for entreprise apps
Modules
for libraries (Java 8 JAR + Java 9 JAR etc.), less useful for entreprise apps
for the Java platform
Switch expressions
Text blocks
Pattern matching on instanceof (2nd preview)
Records
for transfer object etc.
have accessors (no getters ;))
can now have annotations (Java 15)
as tuples?
can be local (inside a method etc.)
Sealed classes
to "lock" hierrachy
ZGC
low latency Garbage collector
How to sell Java upgrade?
performance (memory/CPU usage)
http://trishagee.github.io/presentation/beyond_java_8/
How I Started Contributing to Open Source and Why You Should Too, by Marit van Dijk
Why?
learn
do something useful / give back
fix something you need
build your CV/portfolio
network
Why not?
can be scary
time limitation (family etc.)
legal limitations
bad experiences
What?
fix bugs
add features
refactor
add unit tests
update dependencies
review PRs
help the community (answer questions in forum, chat etc.)
write/enhance documentation (even fix typos)
report issues (ask if not sure, use templates, provide minimal reproducible example MCVE)
How?
Hacktober
find a projet via websites like upforgrabs
see README, CONTRIBUTING, LICENCE, Code of conduct, Style guide, Contributor Licence Agreement
Check for "good first issues" label
Setup your environment
First PR -> feedback (remember "no is temporary, yes is forever")
Let's Get Lazy, by Venkat Subramaniam
Lazy?
Do only when required!
Applicative order
= eager evaluation
what you see is what you get
Normal order
= lazy evaluation
used in Haskell
uncommon
Demo
in Haskell via ghci with breakpoint (:break) #bornLazy
in Scala with a side-effect function (println): "val" vs "lazy val" #canBeLazy
in Java with a side-effect function (println) with a Supplier and a lambda "() -> expensive(x)" # canBeLazy
Java streams
> In CS, we can solve almost every problem by introducing another level of indirection
Java lambda ans streams allow lazyness
> Java lambdas are a gateway drug to streams!
List (collection of data) vs Stream (pipeline of functions)
Benefit: efficiency/performance
Infinite streams
via Streams.iterate(...).filter().limit(10)
used in Reactive programming = FP + lazy evaluation
Learn and Teach Java with JetBrains! By Anna Morozova and Tatiana Vasilyeva
Skipped :/
Do It Yourself: Collections, by Nikhil Nanivadekar
Collections?
basic concepts from JDK collections:
List (orderered, duplicates allowed)
Set (no duplicates)
Map (key -> single value)
What about adding other concepts? (ex : for shopping cart)
Bag (MultiSet)
usage example: shopping cart
example : (apple = 5, bananas = 6)
like list (allows duplicates)
like a set (hashed)
like a map: article is related to count
live demo: implement a Bag
- which is backed by a HashMap
- with intuitive and helpful API that protects the users
Multimap (MultiValueMap)
associates a key to multiple values
values can be: List, Set or Bag
backed by a HashMap<K, Collection>
live demo: implement a MultiMap
Software Modernisation, by Sandro Mancuso
A strategic approach, for software professionnals
SW modernisation?
NOT about general maintenance (refactoring, improving tests etc.)
about increasing business agility
Why is modernisation often neglected?
- tech cargo cults (do TDD, use AWS etc)
- lack of business drivers
Common business drivers
- sustainable changes
goals: reduce lead time, reduce cost of change, reduce technical debit, reduct defect rate
how: CI/CD etc.
- innovation
goals: stay competitive, experiment, data-drive decisions, fast feedback
how: containes experiments, design thinking, lean startup etc.
- leveraging technology
goals: effectiveness, productivity, cost reduction, tech refresh, mitigation against end-of-life
how: eliminate silos, align teams, ubiquitous language, Domain Driven Design
- business alignment
- people & culture
goals: retain/attract talents, culture of learning, leadership at all levels, team autonomy
how: attractive technologies, training, coaching and mentoring, internal communities of pratices
- risk management
goals: observability, security, reduce mean-time-to recover etc.
Common impediments
lack of time/money/skills, oerwhelmed by problems, fear, don't know, lack of visions etc.
Principles
big vision/small increments
value-driven increments
minimal business disruption
pragmatic solutions (can't change everything, don't be a dreamer)
if it ain't broke, don't fix it
law of diminishing returns
Start an initative
1. business alignment: use Value Stream Mapping, identify constraints and metrics (deployment frequency etc.)
2. tech alignment: share the overall high-level architecture, know the tech constraints (SLAs, regulations, skills etc.)
3. tech vision (the big direction)
4. tech strategy: rewrite? refactor? rearchitect? buy? etc.
Impl strategies
dedicated/specialized team
unified backlog prioritised by value
etc.
Modernisation is a project, with a roadmap
... // a bit too chatty? ;-)
OpenJDK: In the new age of Concurrent Garbage Collectors, by Monica Beckwith
G, S, Z: G1, Shenandoah and Z
Stop-the-world (aka STW) vs concurrent collection (thread local handshakes)
Heap layout: regional (Z, S) vs generational (G)
... // Bored me... maybe I'm just tired? :)
Your Tests Lack Vision: Adding Eyes to Your Automation Framework, by Angie Jones
Automate visual testing to prevent:
- inattentional blindness
-visual bugs can make users quit => lose money ("store this card? YesNo[][]")
How?
- pixel by pixel comparison? NO, no sensible
- via machine learning YES ex: AppliTools
Demo:
1. CSS rotation (introduce a visual bug)
2. Test book search with several results
=> Selenium test on DOM test pass (but should not)
=> Selenium test with AppliTools API "eyes.validateWindow()"
=> take picture
=> compare with history (stored in the cloud)
=> "UNRESOLVED" => as a human, decide if OK or not => mark as FAILURE
3. Test book search with single result
=> Selenium test with AppliTools API "eyes.validateRegion()" (?)
Pros/cons
- window
- region: can miss bugs
Regions can be chosen via a GUI
4. Change book order
5. Test book search with several results
=> Selenium test with AppliTools API "eyes.setMatchLevel(MatchLevel.LAYOUT); eyes.validateWindow()" test pass (default match level is "strict")
// OK for smoke tests
Cross-platform visual tests => "visual grid"
addBrowser() // Firefox...
addDevices() // iPhone 6...