[Haskell-cafe] Haskell and the Software design process
rl at cse.unsw.edu.au
Mon May 3 05:09:41 EDT 2010
On 03/05/2010, at 06:02, Jaco van Iterson wrote:
> I was just wondering what methods are best to design/model the software in bigger projects when you are planning to use Haskell.
> Is there no difference compared to other languages? Are there any Haskell tools?
In addition to what Don said, here are a couple of things I've learned. This is just from personal experience so YMMV.
Design in Haskell is much more often bottom-up than in, say, traditional OO where it's frequently top-down all the way. I believe this is mainly due to purity. When you have some kind of global state, your design process often has to be top-down because of intricate interactions between program components which modify that state.
Designing Haskell software tends to involve much fewer diagrams than OO. Your most important design tool is the type system. You can often express large chunks of your design through types and have the compiler check and enforce them. Fiddling with types is often part of the design process and should be treated accordingly. If you stumble on a useful design pattern, think about how to encode it in the type system (this is quite different from OO patterns).
Higher-order functions and type classes are very powerful tools for reducing coupling and for implementing "design patterns".
Prototyping is very cheap and easy. Writing prototypes and playing with them in ghci allows you to see how your subsystems will behave and adjust the design accordingly. In general, you ought to write code (esp. type signatures) while designing.
Some libraries/subsystems will evolve into or start out as EDSLs. This is good and should be encouraged. Identifying EDSLs that would be useful for implementing your software is an important step in the design process.
More information about the Haskell-Cafe