Reader small image

You're reading from  Mastering The Faster Web with PHP, MySQL, and JavaScript

Product typeBook
Published inJun 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788392211
Edition1st Edition
Languages
Right arrow
Author (1)
Andrew Caya
Andrew Caya
author image
Andrew Caya

Andrew Caya started programming computers in GW-BASIC and QBASIC in the early 90s. Before becoming a PHP developer almost 10 years ago, he did some software development in C, C++, and Perl. He is now a Zend Certified PHP Engineer and a Zend Certified Architect. He is also the creator of Linux for PHP, the lead developer of a popular Joomla extension and a contributor to many open source projects. He is currently CEO, CTO and Founder of Foreach Code Factory, an instructor at Concordia University, an author and a technical reviewer for Packt Publishing, and a loving husband and father.
Read more about Andrew Caya

Right arrow

Simplifying functions


Traditionally, computer science students are told to keep their functions simple. It is often said that one function should correspond to one single action. Indeed, the more a function has cyclomatic complexity, the harder it is to reuse, maintain and test. The more a function becomes a purely logical being that has no real-world roots in a clearly identifiable action, the harder it is to grasp and use in combination with other functions.

Functional programming principles

The functional programming (FP) paradigm pushes this reasoning further by considering computational design as being based on mathematical functions and the immutability of state and data. FP's guiding principle is that the entire computer program should be a single, referentially transparent expression. At its core, the concept of FP requires that functions be pure, referentially transparent and free of side effects. A function is pure when, given the same input, it always returns the same output. It...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering The Faster Web with PHP, MySQL, and JavaScript
Published in: Jun 2018Publisher: PacktISBN-13: 9781788392211

Author (1)

author image
Andrew Caya

Andrew Caya started programming computers in GW-BASIC and QBASIC in the early 90s. Before becoming a PHP developer almost 10 years ago, he did some software development in C, C++, and Perl. He is now a Zend Certified PHP Engineer and a Zend Certified Architect. He is also the creator of Linux for PHP, the lead developer of a popular Joomla extension and a contributor to many open source projects. He is currently CEO, CTO and Founder of Foreach Code Factory, an instructor at Concordia University, an author and a technical reviewer for Packt Publishing, and a loving husband and father.
Read more about Andrew Caya