Clean Code With Java 8: Functional Patterns and Best Practices - Live Coding Marathon
Clean Code With Java 8: Functional Patterns and Best Practices - Live Coding Marathon
Victor Rentea
[email protected]
www.VictorRentea.ro
#DevoxxFR @victorrentea 1
Victor Rentea
13 years of Java
[email protected] www.VictorRentea.ro
since 2013
Independent
1500+ hours
Technical Trainer 1000+ developers
Spring
Hibernate
Clean Code, Architectures
Java 8, Design Patterns
Unit Testing
Java Performance
tough clients: Scala & more...
#DevoxxFR @victorrentea 5
Not Convinced?
They were!
Hard-Core Mode
#DevoxxFR @victorrentea
Hard-Core Mode
#DevoxxFR @victorrentea
Let's CODE !!
I'll push everything here:
https://github.com/victorrentea/clean-code-java8-devoxxfr
#DevoxxFR @victorrentea 9
#DevoxxFR @victorrentea
The Clean Code Rules
Applied to Java 8
#DevoxxFR @victorrentea 11
Descriptive Names
a-nonymous functions
BestLambdas
Lambdas are fit, thin one-liners
-> {
Extract heavy lambdas into named ::methods
as static methods
#DevoxxFR @victorrentea 12
Stream Wrecks
1 usecase = 1 single chain of 30 function calls.
#DevoxxFR @victorrentea 13
Optional
No Nullable Parameters
Instead: thatOpt.map(myFunction)
#DevoxxFR @victorrentea 15
Loan Pattern
You work with a resource
that is managed for you
#DevoxxFR @victorrentea 16
Execute Around Pattern
Explicit AOP
~ Proxy™ or Decorator™
#DevoxxFR @victorrentea 17
Avoid Checked Exceptions
java.util.function interfaces don't declare any throws
Which is good !
#DevoxxFR @victorrentea 19
Merci
Let's Chat:
@victorrentea
[email protected]
Disclaimer: The use of ® or
™ is the slides is only www.VictorRentea.ro
anecdotic.
#DevoxxFR @victorrentea 20