- Mastering JavaScript Functional Programming
- Federico Kereki
- 189字
- 2021-07-02 22:41:06
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.
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- AngularJS入門與進階
- 自己動手實現Lua:虛擬機、編譯器和標準庫
- Java:Data Science Made Easy
- Visual C++數字圖像處理技術詳解
- Node.js全程實例
- Learning PHP 7
- C++編程兵書
- MySQL數據庫應用實戰教程(慕課版)
- Visual Basic語言程序設計上機指導與練習(第3版)
- Scratch少兒編程高手的7個好習慣
- Hands-On Data Visualization with Bokeh
- Java與Android移動應用開發:技術、方法與實踐
- Learning RxJava
- 3D Printing Designs:Fun and Functional Projects