Daniel leon design principles in the functional world
-
Upload
codecampiasi -
Category
Technology
-
view
242 -
download
0
description
Transcript of Daniel leon design principles in the functional world
![Page 1: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/1.jpg)
Design Principles in the Functional World
Daniel Leon
Optymyze
[25th of October 2014]
![Page 2: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/2.jpg)
![Page 3: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/3.jpg)
Motivation
![Page 4: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/4.jpg)
Question list
1) Design patterns vs design principles2) Anything else besides design type?3) How about functional principles?
![Page 5: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/5.jpg)
Principle vs patternPrinciple Pattern
Rules Concrete examples
Language/paradigm independent Language/paradigm dependent
Generic diagrams Class UML
![Page 6: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/6.jpg)
Types of programming principles1) Design principles
Single responsibilityOpen/closedLiskov substitutionInterface segregationDependency inversion
2) Packaging principlesCohesionCoupling
![Page 7: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/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: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/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: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/9.jpg)
![Page 10: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/10.jpg)
Creational design patterns
![Page 11: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/11.jpg)
Factory
![Page 12: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/12.jpg)
Lazy initialization
![Page 13: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/13.jpg)
Singleton
![Page 14: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/14.jpg)
![Page 15: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/15.jpg)
Structural design patterns
![Page 16: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/16.jpg)
Adapter
![Page 17: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/17.jpg)
Decorator
![Page 18: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/18.jpg)
![Page 19: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/19.jpg)
Behavioral design patterns
![Page 20: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/20.jpg)
Chain of responsibility
![Page 21: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/21.jpg)
Command
![Page 22: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/22.jpg)
Command
![Page 23: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/23.jpg)
Dependency inversion
![Page 24: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/24.jpg)
Null object
![Page 25: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/25.jpg)
Strategy
![Page 26: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/26.jpg)
![Page 27: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/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: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/28.jpg)
My reaction to Java 8
![Page 29: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/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: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/30.jpg)
![Page 31: Daniel leon design principles in the functional world](https://reader036.fdocuments.us/reader036/viewer/2022062514/559365091a28ab5e0e8b45ce/html5/thumbnails/31.jpg)
Design Principles in the Functional World
Daniel Leon[Optymyze]
[25th of October 2014]
Please fill the online evaluation form after event