daniel leon design principles in the functional world
DESCRIPTION
CodeCampIasi25Oct2014TRANSCRIPT
Design Principles in the Functional World
Daniel Leon
Optymyze
[25th of October 2014]
Motivation
Question list
1) Design patterns vs design principles2) Anything else besides design type?3) How about functional principles?
Principle vs patternPrinciple Pattern
Rules Concrete examples
Language/paradigm independent Language/paradigm dependent
Generic diagrams Class UML
Types of programming principles1) Design principles
Single responsibilityOpen/closedLiskov substitutionInterface segregationDependency inversion
2) Packaging principlesCohesionCoupling
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.
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.
Creational design patterns
Factory
Lazy initialization
Singleton
Structural design patterns
Adapter
Decorator
Behavioral design patterns
Chain of responsibility
Command
Command
Dependency inversion
Null object
Strategy
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
My reaction to Java 8
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
Design Principles in the Functional World
Daniel Leon[Optymyze]
[25th of October 2014]
Please fill the online evaluation form after event