Why learn functional programming? For better design skills!
The other day we designed a process to match cleared deposits with dispensations. This is how I would have white-boarded it a few years ago:
Thinking about the problem in this way leads to this kind of diagram:
Thinking about the program as a data pipeline keeps me thinking about what needs to happen, instead of how each step should be done. It’s a higher level of thinking that keeps us from bogging down in implementation details at the design phase.
Whatever language we use to write the solution, thinking about it this way has the following advantages:
* It breaks down into pieces. (The orange boxes represent JIRA tasks.) The requirements are already specified on the diagram: what goes in, what comes out. Each task can be developed independently.
* Each bit is testable. The database-impacting pieces are called out; other than that, each box is defined entirely by input and output. That’s the easiest kind of component to test.
In this way, thinking functionally helps with agile (task breakdown), TDD, and maintainability. The code is more composable. Thinking about the problem is easier because we can see what the data looks like at each step.
Independent, testable components: that’s functional.
For how functional thinking helps at a lower level too, check this post.
New coding tricks are fun, but new white board techniques are serious business.
