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

  • Mastering Immutable.js
  • Adam Boduch
  • 237字
  • 2021-07-08 10:29:59

Preface

I like functional programming languages. One of my favorite features is native immutability. Some functional languages, by default, don't let you change values. What's amazing about this capability is that you can't accidentally break your application by mutating data at the wrong time. If you try, the code won't even compile.

I also dislike certain aspects of functional programming languages. On one hand, it's great that immutability is enforced the way it is. On the other hand, there are times when I just need to push aside my functional programming principles and get the job done.

The JavaScript language has many useful functional programming features out of the box. You don't need a library to compose higher-order functions, for example. Something that's difficult to get right with JavaScript is immutability. This is where Immutable.js shines.

When I first heard about Immutable.js, I pictured a library that enforced immutability on JavaScript structures and nothing more. It turns out there's much more. When you're working with immutable structures, you're constantly creating them. The Immutable.js collection API helps you create the structures you need, when you need them.

Since this is a JavaScript library, there's no immutability by default. This allows me to use Immutable.js where immutability matters, and to mutate things when I need to. This is what makes this such an essential library for applications in the real world; pragmatic functional programming that gets the job done.

主站蜘蛛池模板: 石渠县| 遂宁市| 棋牌| 建德市| 玉屏| 洛扎县| 靖州| 宣威市| 丰城市| 土默特左旗| 遂川县| 沧州市| 白河县| 罗田县| 镶黄旗| 千阳县| 图木舒克市| 水富县| 海南省| 唐海县| 定边县| 大庆市| 金沙县| 文安县| 苍南县| 宣恩县| 册亨县| 通渭县| 定远县| 安阳市| 吴川市| 八宿县| 大英县| 崇仁县| 文登市| 德钦县| 海淀区| 五大连池市| 静安区| 平利县| 龙口市|