6 Writing Functional Code
This chapter will elaborate on a core facet of this book, 'functional programming'. At first functional programming might seem to be the odd chapter out. But here’s why it is not. A central goal of this book is about making the web a more amenable environment for programming. And bringing up the, seemingly unrelated, technique of functional programming has a lot to do with that. Much in the way the technologies showcased in this book 'unify' platforms, functional programming 'unifies' many language concepts. Functial code is 'excellent' glue. [17] Functional code enables highly modular development. You can build programs bottom-up and assemble all the independent parts easily.
The definition of 'functional programming' that I’m going to offer is pithy. Functional programming is all about programming using 'mathematical functions'. Before you run screaming into the mountains, take a second to recall some terminology. In mathematics, a function relates an input to an output. We call the input the 'domain' of the function and we call the output the 'range'. In programming, we usually just stick with the terms 'input' and 'output', but it is helpful to know both.