官术网_书友最值得收藏!

What we get

So, now, does FP get you these five characteristics?

  • In FP, the goal is writing separate independent functions, which are joined together to produce the final results.
  • Programs written in functional style usually tend to be cleaner, shorter, and easier to understand.
  • Functions can be tested on its own, and FP code has advantages for that.
  • You can reuse functions in other programs, because they stand on their own, not depending on the rest of the system. Most functional programs share common functions, several of which we'll be considering in this book.
  • Functional code is free from side effects, which means you can understand the objective of a function by studying it, without having to consider the rest of the program.

Finally, once you get used to FP ways, code becomes more understandable and easier to extend. So, it seems that all five characteristics can be ensured with FP!

For a well balanced look at reasons for FP, I'd suggest reading Why Functional Programming Matters, by John Hughes; it's available online at www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf. It's not geared towards JS, but the arguments are easily understandable, anyway.

主站蜘蛛池模板: 崇州市| 潜山县| 鸡泽县| 合肥市| 庐江县| 鄂托克前旗| 屯昌县| 沙坪坝区| 惠州市| 达拉特旗| 旬阳县| 广德县| 黄浦区| 聂拉木县| 宣城市| 鄄城县| 轮台县| 民权县| 威信县| 阳山县| 贞丰县| 玉屏| 交城县| 扶沟县| 琼结县| 莫力| 清镇市| 通榆县| 杨浦区| 华安县| 舟山市| 乌拉特中旗| 锡林郭勒盟| 龙泉市| 宜兰市| 重庆市| 濉溪县| 木里| 离岛区| 名山县| 民县|