Thinking Functionally in PHP

Автор: literator от 25-10-2022, 15:42, Коментариев: 0

Категория: КНИГИ » ПРОГРАММИРОВАНИЕ

Thinking Functionally in PHPНазвание: Thinking Functionally in PHP
Автор: Larry Garfield
Издательство: Leanpub
Год: 2021-04-25
Страниц: 157
Язык: английский
Формат: pdf (true), mobi, epub
Размер: 10.2 MB

Approaching PHP from a functional perspective. Yes, really. With just a pinch of category theory.

Functional programming has a reputation of being too nerdy, academic, and inscrutable to be useful for "common" programmers. That reputation is only partially unearned, but the concepts behind functional programming are entirely within reach of every programmer in any modern language. That includes PHP. This book takes the reader through the basics of functional programming, the new capabilities of PHP 7.4 that make it even easier, and the computer-science-y underpinnings that make it all possible.

Combined with PHP’s overall clunky syntax for doing functional-esque code, I generally didn’t go further than “pure functions are your friend,” either in my own code or what I explained to others. That is, until PHP 7.4. PHP 7.4’s introduction of short lambdas is, as we’ll see in this book, a game-changer. While it doesn’t make anything new possible, it makes a lot of things suddenly practical. That makes all the difference, so I decided it was time to buckle down and really dig into functional programming.

In recent years, functional programming has become increasingly popular as a concept. Even in “non-functional” programming languages, the concepts and practices of functional programming have become more mainstream. Why is that? Are they actually useful, or is functional programming in a language other than Haskell just trying to fit a square peg into a round hole? What even is functional programming, and does it make sense in PHP? This book aims to answer those questions. (Spoiler alert: The answer is yes.) While writing PHP as if it were Haskell, ML, or LISP is not going to produce a good result, the underlying principles behind functional programming offer many advantages, even in PHP. Other parts, however, do not, and that’s okay.

The aim of this book is not to convince you to write all PHP code in a strictly and rigidly functional fashion. Rather, the aim is to encourage you to approach problems from a functional mindset and apply the underlying principles of functional programming… most of the time. Many of them, in fact, you have no doubt encountered before in other contexts talking about “good code” under different names, such as the SOLID principles. That’s a good sign the concepts involved are a good idea.

Computer scientists and software engineers tend to speak in entirely different languages, which is part of what makes learning more academic concepts difficult. This book offers both: Practical, applicable examples of how to leverage functional programming, category theory, and even the scary m-word. We start with the very basics and build up slowly, covering both the practical and theoretical just enough to be useful in everyday code.

Скачать Thinking Functionally in PHP








Нашел ошибку? Есть жалоба? Жми!
Пожаловаться администрации
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.