design principles in the functional world
TRANSCRIPT
![Page 1: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/1.jpg)
Design Principles in the Functional World
Daniel Leon
Optymyze
[25th of October 2014]
![Page 2: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/2.jpg)
![Page 3: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/3.jpg)
Motivation
![Page 4: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/4.jpg)
Question list
1) Design patterns vs design principles2) Anything else besides design type?3) How about functional principles?
![Page 5: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/5.jpg)
Principle vs patternPrinciple Pattern
Rules Concrete examples
Language/paradigm independent Language/paradigm dependent
Generic diagrams Class UML
![Page 6: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/6.jpg)
Types of programming principles1) Design principles
Single responsibilityOpen/closedLiskov substitutionInterface segregationDependency inversion
2) Packaging principlesCohesionCoupling
![Page 7: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/7.jpg)
Object-oriented principlesSingle Responsibility Principle - A class should have one, and only one, reason to change.
Open-Closed Principle - You should be able to extend a classes behavior, without modifying it.
Liskov Substitution Principle - Derived classes must be substitutable for their base classes.
Interface Segregation Principle – Make fine grained interfaces that are client specific.
Dependency Injection Principle - Depend on abstractions, not on concretions.
![Page 8: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/8.jpg)
Functional principles ?Single Responsibility Principle - A function should have one, and only one, reason to change.
Open-Closed Principle - You should be able to extend a function behavior, without modifying it.
Liskov Substitution Principle - Derived functions must be substitutable for their base functions.
Interface Segregation Principle – Make fine grained traits that are client specific.
Dependency Injection Principle - Depend on traits, not on concretions.
![Page 9: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/9.jpg)
![Page 10: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/10.jpg)
Creational design patterns
![Page 11: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/11.jpg)
Factory
![Page 12: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/12.jpg)
Lazy initialization
![Page 13: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/13.jpg)
Singleton
![Page 14: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/14.jpg)
![Page 15: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/15.jpg)
Structural design patterns
![Page 16: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/16.jpg)
Adapter
![Page 17: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/17.jpg)
Decorator
![Page 18: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/18.jpg)
![Page 19: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/19.jpg)
Behavioral design patterns
![Page 20: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/20.jpg)
Chain of responsibility
![Page 21: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/21.jpg)
Command
![Page 22: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/22.jpg)
Command
![Page 23: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/23.jpg)
Dependency inversion
![Page 24: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/24.jpg)
Null object
![Page 25: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/25.jpg)
Strategy
![Page 26: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/26.jpg)
![Page 27: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/27.jpg)
Conclusions
• Patterns are to principles what are implementations to patterns
• Sometimes to much design patterns in code shows the lack of design principles implementation in the language
• Java 8 still has some work to do in order to catch-up Scala
![Page 28: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/28.jpg)
My reaction to Java 8
![Page 29: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/29.jpg)
Bibliographyhttp://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf
http://java.dzone.com/articles/design-patterns-decorator http://pavelfatin.com/design-patterns-in-scala
![Page 30: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/30.jpg)
![Page 31: Design principles in the functional world](https://reader034.vdocuments.site/reader034/viewer/2022042907/5884f61c1a28abf76f8b6f91/html5/thumbnails/31.jpg)
Design Principles in the Functional WorldDaniel Leon[Optymyze]
[25th of October 2014]
Please fill the online evaluation form after event