[Haskell-cafe] FP design
Levi Stephen
levi.stephen at optusnet.com.au
Wed Nov 7 18:06:14 EST 2007
Bulat Ziganshin wrote:
> Hello Andrew,
>
> Tuesday, November 6, 2007, 10:55:58 PM, you wrote:
>
>>> for me, abstraction is anything that i want to be an abstraction. i
>>> just write code in the close-to-natural language and it becomes
>>> Haskell program when appropriate syntax applied.
>
>> Well, in my experience, figuring out just the right abstractions to use
>
> i don't think about abstractions, just using top-down approach. for
> me, FP benefit is that when you see that some two things are similar -
> you can factor out this similarity. in OOP, you should translate it
> into some class interface, in Haskell you just define parameterized
> code/data and it works. selection of good abstractions based on these
> two criteria: 1) factoring out common parts and 2) existence of
> natural description of the factored part. if i don't see natural
> description, i can slightly change the factored part
>
>
This thread sums up some of my thoughts pretty well. I'm coming from OOP where I
was getting comfortable and was confident of spotting appropriate abstractions.
Now I have to learn how to select the appropriate abstractions in Haskell. e.g.,
selecting between a variant type or type class is often a tricky one for me.
It is good to hear that people are having success with the code, refactor
duplication, repeat process. I have used this in OOP as well and the path it
takes is interesting to compare with initial design thoughts. Again, it's just
choosing the best way to remove this duplication :)
Levi
More information about the Haskell-Cafe
mailing list