Functional PHP

Gilles Crettenand

  • 出版商: Packt Publishing
  • 出版日期: 2017-02-17
  • 售價: $1,730
  • 貴賓價: 9.5$1,644
  • 語言: 英文
  • 頁數: 342
  • 裝訂: Paperback
  • ISBN: 1785880322
  • ISBN-13: 9781785880322
  • 相關分類: PHP
  • 海外代購書籍(需單獨結帳)

買這商品的人也買了...

商品描述

Key Features

  • Greatly improve your code quality, testability, and readability using modern functional programming techniques
  • Get a solid foundation in functional programming techniques and methodologies
  • Step-by-step learn the concepts to architect more robust code

Book Description

A functional approach encourages code reuse, greatly simplifies testing, and results in code that is concise and easy to understand. This book will demonstrate how PHP can also be used as a functional language, letting you learn about various function techniques to write maintainable and readable code.

After a quick introduction to functional programming, we will dive right in with code examples so you can get the most of what you ve just learned. We will go further with monads, memoization, and property-based testing. You will learn how to make use of modularity of function while writing functional PHP code.

Through the tips and best practices in this book, you ll be able to do more with less code and reduce bugs in your applications. Not only will you be able to boost your performance, but you will also find out how to eliminate common loop problems. By the end of the book, you will know a wide variety of new techniques that you can use on any new or legacy codebase.

What you will learn

  • Declare functions/callables and find out how to manipulate and call them
  • Write pure functions to get more robust code that can be easily tested
  • Learn to compose function using various techniques
  • Use a functional approach to find readable solutions to common issues
  • Utilize performance optimization techniques such as laziness, memorization, and parallelization
  • Build the business logic of applications with the functional paradigm
  • Test functional code and know how to speed up test runs using parallel testing
  • Understand the impact and limitation of functional programming in PHP

About the Author

Gilles Crettenand is a passionate and enthusiastic software developer. He thrives when solving challenges and is always on the lookout for a better way to implement his solutions. He has a bachelor's degree in computer science from the School of Engineering and Management Vaud in Switzerland and has more than 6 years of experience as a web developer.

Most of his professional career has been spent using PHP, developing a variety of applications ranging from accountability software to e-commerce solutions and CMS. At nights, however, he likes to try other languages, dabbling with Haskell, Scala, and more recently, PureScript, Elm, and Clojure.

Being a certified scrum master, he understands the need to use the right tool for the job and maintaining a readable and maintainable codebase using the best techniques and practices available.

Table of Contents

  1. Functions as First Class Citizens in PHP
  2. Pure Functions, Referential Transparency, and Immutability
  3. Functional Basis in PHP
  4. Composing Functions
  5. Functors, Applicatives, and Monads
  6. Real-Life Monads
  7. Functional Techniques and Topics
  8. Testing
  9. Performance Efficiency
  10. PHP Frameworks and FP
  11. Designing a Functional Application
  12. What Are We Talking about When We Talk about Functional Programming

商品描述(中文翻譯)

主要特點


  • 使用現代函數式編程技術,大幅提升代碼質量、可測試性和可讀性

  • 建立堅實的函數式編程技巧和方法論基礎

  • 逐步學習架構更健壯的代碼的概念

書籍描述

函數式編程方法鼓勵代碼重用,大大簡化測試,並產生簡潔易懂的代碼。本書將展示PHP也可以作為一種函數式語言使用,讓您學習各種函數技巧,以編寫易於維護和可讀的代碼。

在快速介紹函數式編程後,我們將立即通過代碼示例深入探討,以便您能夠充分利用所學知識。我們將進一步介紹單子、記憶化和基於屬性的測試。您將學習在編寫函數式PHP代碼時如何利用函數的模塊化。

通過本書中的提示和最佳實踐,您將能夠用更少的代碼做更多的事情,減少應用程序中的錯誤。您不僅能夠提高性能,還將了解如何消除常見的循環問題。通過本書,您將學習到各種新技術,可以應用於任何新的或遺留的代碼庫。

您將學到什麼


  • 聲明函數/可調用對象,並了解如何操作和調用它們

  • 編寫純函數以獲得更健壯的代碼,並易於測試

  • 學習使用各種技巧組合函數

  • 使用函數式方法找到可讀的解決方案來解決常見問題

  • 利用惰性、記憶化和並行化等性能優化技巧

  • 使用函數式範式構建應用程序的業務邏輯

  • 測試函數式代碼,並了解如何使用並行測試加快測試運行速度

  • 了解函數式編程在PHP中的影響和限制

關於作者

Gilles Crettenand 是一位充滿熱情和熱衷的軟件開發人員。他喜歡解決挑戰,並一直在尋找更好的方法來實現解決方案。他擁有瑞士Vaud工程與管理學院的計算機科學學士學位,並擁有超過6年的網絡開發經驗。

他的職業生涯大部分時間都在使用PHP,開發各種應用程序,從負責軟件到電子商務解決方案和內容管理系統。然而,在晚上,他喜歡嘗試其他語言,涉獵Haskell、Scala,最近還有PureScript、Elm和Clojure。

作為一位認證的Scrum Master,他明白在工作中使用合適的工具的必要性,並使用最佳技術和實踐來維護可讀性和可維護性的代碼庫。

目錄


  1. PHP中的函數作為一等公民

  2. 純函數、引用透明度和不可變性

  3. PHP中的函數式基礎

  4. 組合函數

  5. 函子、應用函數和單子

  6. 實際應用的單子

  7. 函數式技巧和主題

  8. 測試

  9. 性能效率

  10. PHP框架和函數式編程

  11. 設計一個函數式應用程序

  12. 當我們談論函數式編程時,我們在談論什麼