Principles, Best Practices and Design Patterns for functional programming

后端 未结 7 1513
我在风中等你
我在风中等你 2021-01-31 09:56

Are there any known principles, best-practices and design patterns that one can follow while writing code in a functional programming language?

7条回答
  •  心在旅途
    2021-01-31 10:32

    I'd answer with perhaps a bit vague principle: strive to make your code beautiful as the most important aspect. To quote David Gelernter:

    Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defence against complexity.

    and Brian Kernighan:

    Controlling complexity is the essence of computer programming.

    If you pursue this goal, it will lead you to write code that is easy to read and understand (which is very important), code that is split into small, compact parts with well defined purpose. It will lead you to learn how to express your thoughts in the best way in the particular language.

    (All this doesn't apply just to functional languages, but writing beautiful code is so much easier in them.)

提交回复
热议问题