Approach to designing large functional programs?

Thank you, very much what I was looking for! – Jeffrey Cameron Sep 2 at 12:10.

One of the influental works on the subject of FP Why Functional Programming Matters by John Hughes can be considered as a direct answer: Our ability to decompose a problem into parts depends directly on our ability to glue solutions together. To support modular programming, a language must provide good glue. Functional programming languages provide two new kinds of glue — higher-order functions and lazy evaluation.

Using these glues one can modularize programs in new and useful ways, and we’ve shown several examples of this. Smaller and more general modules can be reused more widely, easing subsequent programming. This explains why functional programs are so much smaller and easier to write than conventional ones.It also provides a target for functional programmers to aim at.

If any part of a program is messy or complicated, the programmer should attempt to modularize it and to generalize the parts. He or she should expect to use higher-order functions and lazy evaluation as the tools for doing this. I would also recommend looking at contemporary interview with John Hughes in InfoQ.

Not sure I understand what is meant by "inside out" / "outside in", but FP is most useful "in the small" -- at the function level. OO is probably still the best way to organize projects in the large. It's easiest to deal with objects that correlate with your business domain.

One article that really helped me come to terms with functional programming is this one: prog21.dadgum.com/23.html It is a tutorial for how to create a Pac-Man clone using functional-programming techniques. I don't even recognize the language he used (it might have been Erlang,) but the explanation helped me understand the correct mindset which I used when rewriting one of my programs in Scheme.

I guess by outside in you mean top to bottom approach and by inside out you mean from bottom to top. If this is what you mean than FP is more suited towards bottom up approach i. E inside out.

While designing FP programs think about solving the problem using: Data Structure : What all data your application needs to handle and which data structure is most suitable to represent that data. Function : A function does one thing (and do it correctly). Composition : Create new functions which achieve their goals by composing other functions using technique like higher order functions and compositions.

Other more advance and abstract FP techniques like Monads etc. So basically you start from bottom, for each atomic problem you write a function and then as you move upward in the design you use these atomic function to create functions at higher level using composition. Remember always think of solving problem using abstractions and composition of those abstraction rather than thinking sequentially as you would do in a imperative programming.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions