2. www.luxoft.co
m
About me:
• Lead Software Engineer in Luxoft
• More then 6 years experience in Java
• Agile and Lean practicioner
• Pragmatic and product oriented engineer
• Still learning and learn
Email: hunter041@gmail.com
Twitter: @apashinskiy_cv
Alexander Pashinskiy
8. www.luxoft.co
m
• OOP (Resource acquisition is initialization,
Servant, DI, Pool Objects, Null object …)
• FP (Functions, Monads, Lenz, Curring, …)
• Concurrency (Double-checked locking, Read-write
lock, Thread-specific storage, …)
• Domain Specific (security, money, …)
• and many, many more
9. www.luxoft.co
m
• Problem - Solution pairs
• Similar (or same) solution - different intention (Strategy,
State …)
• inheritance - composition game (OOP)
• Adding level of indirection
• Almost always trade-off
Design Patterns:
10. www.luxoft.co
m
• 1994 year
• For C++
• OOP
Two main principles:
• "Program to an interface, not an implementation."
• "Favor object composition over class inheritance."
Sad:(
Some GoF patterns do not stick to this principles
11. www.luxoft.co
m
• Not only for data
• BLSP
• Violates “Single Responsibility” and encapsulation
• High Coupling
• Future behavior and frameworks inhereted
• Broken “protected” in Java
• Big hierarchy produces hell
Inheritance
16. www.luxoft.co
m
Template method
inheritance
• to create new Mailbox you need inherit from
• behavior is scattered through the class hierarchy
• 2 responsibility (be mail box and filter)
• public abstract class
32. www.luxoft.co
m
Currying
Currying - technique of translating the evaluation of a function that
takes multiple parameters into evaluating a sequence of functions, each
with a single argument.
33. www.luxoft.co
m
Currying + Partial application
• allows to set some (not all) parameters
• let the other parameters to be set later
• partially applied function can be reused and
composed
• Powerful decoupling tool
51. www.luxoft.co
m
Builder
• No boiler-plate any more
• Simple reusability (again function
composition)
• Nice chaining DSL
• Reusable
• Consumer has internal control on objet
57. www.luxoft.co
m
• functions
• higher order function
• function composition
• partially applies functions
• currying
• monads
• and more ...
New Designer’s Toolbox
59. www.luxoft.co
m
“In the book we only tell when to apply pattern, but
we never talk about when to remove a pattern.
Removing a pattern can simplify a system and a
simple solution should almost always win. Coming up
with a simple solutions is the real challenge.”
E.Gamma
60. www.luxoft.co
m
• no silver bullet
• OOP is alive
• GoF “Design Patterns” is still valid
• you just have additional design tools
• almost always trade-off
• use your mind
And remember: