Handling incremental Data Modeling Changes in Functional Programming
- by Adam Gent
Most of the problems I have to solve in my job as a developer have to do with data modeling.
For example in a OOP Web Application world I often have to change the data properties that are in a object to meet new requirements.
If I'm lucky I don't even need to programmatically add new "behavior" code (functions,methods). Instead I can declarative add validation and even UI options by annotating the property (Java).
In Functional Programming it seems that adding new data properties requires lots of code changes because of pattern matching and data constructors (Haskell, ML).
How do I minimize this problem?
This seems to be a recognized problem as Xavier Leroy states nicely on page 24 of "Objects and Classes vs. Modules"
- To summarize for those that don't have a PostScript viewer it basically says FP languages are better than OOP languages for adding new behavior over data objects but OOP languages are better for adding new data objects/properties.
Are there any design pattern used in FP languages to help mitigate this problem?
I have read Phillip Wadler's recommendation of using Monads to help this modularity problem but I'm not sure I understand how?