Mastering+JavaScript+Functional+Programming-Packt+Publishing(201...
In computer programming, paradigms abound: Some examples are imperative programming, structured (go to less) programming, object-oriented programming, aspect-oriented programming, and declarative programming. Lately, there has been renewed interest in a particular paradigm that can arguably be considered to be older than most (if not all) of the cited ones--functional programming. Functional Programming (FP) emphasizes writing functions, and connecting them in simple ways to produce more understandable and more easily tested code. Thus, given the increased complexity of today's web applications, it's logical that a safer, cleaner way of programming would be of interest. This interest in FP comes hand-in-hand with the evolution of JavaScript. Despite its somewhat hasty creation (reportedly managed in only 10 days, in 1995, by Brendan Eich at Netscape), today it's a standardized and quickly growing language, with features more advanced than most other similarly popular languages. The ubiquity of the language, which can now be found in browsers, servers, mobile phones, and whatnot, has also impelled interest in better development strategies. Also, even if JavaScript wasn't conceived as a functional language by itself, the fact is that it provides all the features you'd require to work in that fashion, which is another plus. It must also be said that FP hasn't been generally applied in industry, possibly because it has a certain aura of difficulty, and is thought to be theoretical rather than practical, even mathematical, and possibly uses vocabulary and concepts that are foreign to developers--Functors? Monads? Folding? Category theory? While learning all this theory will certainly be of help, it can also be argued that even with zero knowledge of the previous terms, you can understand the tenets of FP, and see how to apply it in your programming. FP is not something you have to do on your own, without any help. There are many libraries and frameworks that incorporate, in greater or lesser degrees, the concepts of FP. Starting with jQuery (which does include some FP concepts), passing through Underscore and its close relative LoDash, or other libraries such as Ramda, and getting to more complete web development tools such as React and Redux, Angular, or Elm (a 100% functional language, which compiles into JavaScript), the list of functional aids for your coding is ever growing. Learning how to use FP can be a worthwhile investment, and even though you may not get to use all of its methods and techniques, just starting to apply some of them will pay dividends in better code. You need not try to apply all of FP from the start, and you need not try to abandon every non-functional feature in the language either. JavaScript assuredly has some bad features, but it also has several very good and powerful ones. The idea is not to throw everything you learned and use and adopt a 100% functional way; rather, the guiding idea is evolution, not revolution. In that sense, it can be said that what we'll be doing is not FP, but rather Sorta Functional Programming (SFP), aiming for a fusion of paradigms. A final comment about the style of the code in this book--it is quite true that there are several very good libraries that provide you with functional programming tools: Underscore, LoDash, Ramda, and more are counted among them. However, I preferred to eschew their usage, because I wanted to show how things really work. It's easy to apply a given function from some package or other, but by coding everything out (a vanilla FP, if you wish), it's my belief that you get to understand things more deeply. Also, as I will comment in some places, because of the power and clarity of arrow functions and other features, the pure JS versions can be even simpler to understand!
- 粉丝: 35
- 资源: 367
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 新建 Microsoft Word 文档
- (176102016)MATLAB代码:考虑灵活性供需不确定性的储能参与电网调峰优化配置 关键词:储能优化配置 电网调峰 风电场景生成 灵活性供需不
- SINAMICS S120驱动第三方直线永磁同步电机系列视频-配置和优化.mp4
- (175601006)51单片机交通信号灯系统设计
- Starter SINAMICS S120驱动第三方直线永磁同步电机系列视频-调试演示.mp4
- (174755032)抽烟、烟雾检测voc数据集
- 基于滑膜控制的差动制动防侧翻稳定性控制,上层通过滑膜控制产生期望的横摆力矩,下层根据对应的paper实现对应的制动力矩分配,实现车辆的防侧翻稳定性控制,通过通过carsim和simulink联合仿真
- 伺服系统基于陷波滤波器双惯量伺服系统机械谐振抑制matlab Simulink仿真 1.模型简介 模型为基于陷波滤波器的双惯量伺服系统机械谐振抑制仿真,采用Matlab R2018a Simul
- (175989002)DDR4 JESD79-4C.pdf
- lanchaoHunanHoutaiQiantai