Wednesday, March 19, 2008

Well said

From the GHC wiki:
It's much better to write code that is transparent than to write code that is short.

Often it's better to write out the code longhand than to reuse a generic abstraction (not always, of course). Sometimes it's better to duplicate some similar code than to try to construct an elaborate generalisation with only two instances. Remember: other people have to be able to quickly understand what you've done, and overuse of abstractions just serves to obscure the really tricky stuff.

3 comments:

Unknown said...

I'd dispute the "often". Also, the fact that such situations may exist is no excuse for not providing some abstraction mechanism in a language! :-)

Jeff said...
This comment has been removed by the author.
Jeff said...

I think this is more a commentary on the stupidity of people rather than languages. Languages often provide way too much abstraction given their target audience.

(misspelled 'too', I'm stupid)