- Mastering JavaScript Functional Programming
- Federico Kereki
- 232字
- 2021-07-02 22:41:05
A different way of thinking
FP implies a different way of writing programs, which can sometimes be difficult to learn. In most languages, programming is done in imperative fashion: a program is a sequence of statements, executed in a prescribed fashion, and the desired result is achieved by creating objects and doing manipulations on them, which usually modify the objects themselves. FP is based on producing the desired result by evaluating expressions, built out of functions composed together. In FP, it's usual to pass functions around (as parameters to other functions, or returned as the result of some calculation), to not use loops (opting for recursion instead), and to skip side effects (such as modifying objects or global variables).
Another way of saying this, is that FP focuses on what should be done, rather than on how. Instead of worrying about loops or arrays, you work at a higher level, considering what you need to be done. After getting accustomed to this style, you'll find that your code becomes simpler, shorter, more elegant, and can be easily tested and debugged. However, don't fall into the trap of considering FP as a goal! Think of FP only as a means towards an end, as with all software tools. Functional code isn't good just for being functional... and writing bad code is just as possible with FP as with any other techniques!
- Python編程自學手冊
- Spring 5.0 Microservices(Second Edition)
- Redis入門指南(第3版)
- Python面向?qū)ο缶幊蹋簶嫿ㄓ螒蚝虶UI
- 大模型RAG實戰(zhàn):RAG原理、應用與系統(tǒng)構建
- Python Data Analysis Cookbook
- Getting Started with React Native
- C編程技巧:117個問題解決方案示例
- Visual C#(學習筆記)
- Learning PrimeFaces Extensions Development
- Python程序設計案例教程
- Web前端開發(fā)實戰(zhàn)教程(HTML5+CSS3+JavaScript)(微課版)
- C++游戲設計案例教程
- Python語言及其應用(第2版)
- 西門子PLC 200/300/400應用程序設計實例精講(第2版)