I have been exploring Clojure for a while now, although I haven’t used it on any nontrivial projects. Basically, I have just been getting comfortable with the syntax and some of the idioms. Coming from an OOP background, with Clojure being the first functional language that I have looked very much into, I’m naturally not as comfortable with the functional way of doing things.
That said, are there any specific workflows or design patterns that are common with creating large functional applications? I’d really like to start using functional programming “for real”, but I’m afraid that with my current lack of expertise, it would result in an epic fail.
The “Gang of Four” is such a standard for OO programmers, but is there anything similar that is more directed at the functional paradigm? Most of the resources that I have found have great programming nuggets, but they don’t step back to give a broader, more architectural look.
4
Patterns of this kind are usually symptoms of a broken, unfit underlying model.
OOP is broken by design, unfit for the most of its applications, therefore it bursts with all that so called “patterns”. Functional model is (just a bit) more flexible, and the need in “patterns” is not that obvious there.
Once you start applying a (natural for the functional programmers) language-oriented approach, using or creating DSLs for each specific problem domain, you’ll find that no patterns are showing up at all, because you’re always employing an adequate model for describing a problem.
Of course some recurring high level “patterns” or “recipes” are unavoidable even in the very abstract, clean and pure math, but they’re of a different kind and of a different level of abstraction than the GoF patterns. You’ll find monads useful, for example.
3
In my personal opinion, design patterns are semantic. I remember rewriting some of my old apps using MVC just to make sure I understood the pattern as well as I thought I did. But, in the end, I didn’t gain anything from MVC over my original code.
However, if I were to apply my original code to a larger development environment and tell someone that there is an issue with this certain method… it would be hard for that developer to track down the problem. HOWEVER, if I said tht the ContractController was mucked up for some reason, (s)he would know exactly where to start.
Design patterns are great… but like I said, I think they are semantic!
EDIT: You evangelist types crack me up. How did anything ever get developed without MVC (or some other design pattern)!
7