Java Patterss
Java Patterss
Contact Info
Ken Kousen
Kousen IT, Inc.
[email protected]
http://www.kousenit.com
http://kousenit.org (blog)
@kenkousen
Videos
O'Reilly video courses: See Safari Books Online for details
Groovy Programming Fundamentals
Practical Groovy Programming
Mastering Groovy Programming
Learning Android
Practical Android
Gradle Fundamentals
Gradle for Android
Spring Framework Essentials
Advanced Java Development
Modern Java Recipes
Source code:
https://github.com/kousen/java_8_recipes
https://github.com/kousen/from-gof-to-lambda
https://github.com/mariofusco/from-gof-to-lambda
http://agiledeveloper.com/
Mario Fusco
Design Patterns posts:
https://www.voxxed.com/2016/04/gang-four-patterns-functional-light-part-1/
https://www.voxxed.com/2016/05/gang-four-patterns-functional-light-part-2/
https://www.voxxed.com/2016/05/gang-four-patterns-functional-light-part-3/
Me: Hey, I'm writing a talk on design patterns in Java
You: Dude, 1994 called and they want their talk back
Me: Yeah, well, 1998 called and they want their meme back
You: Tell them they can keep it
http://www.urbandictionary.com/define.php?term=X%20Called%2C%20they%20want%20their%20Y%20Back
Design Patterns:
Elements of Reusable
Object-Oriented Software
Anybody?
Design Patterns book
Code examples were in what languages?
Anybody?
- Creational
- Structural
- Behavioral
GoF Patterns
Wait, what? Behavioral? Why wrap operations inside classes?
https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
GoF Patterns
Wait, what? Behavioral? Why wrap operations inside classes?
https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
java.util.Iterator
- boolean hasNext()
- E next()
- default void remove()
- default void forEachRemaining(Consumer)
Iterator
java.util.Iterable
Create an "executor"
A Model 2 framework
Command
This all sounds familiar
A Model 2 framework
A Model 2 framework
A Model 2 framework
Closure composition
Consumer: andThen
Allocation, cleanup
Filter on Optional.isPresent()
Remember:
"a comic says funny things; a comedian says things funny"
Conclusions
- Design Patterns wrapped methods in classes
- Lambdas let us unwrap them
- Composition helps
Remember:
"a comic says funny things; a comedian says things funny"