How to write functionally in a web framework

Posted by Kevin Burke on Programmers See other posts from Programmers or by Kevin Burke
Published on 2012-03-14T07:02:58Z Indexed on 2012/04/12 17:41 UTC
Read the original article Hit count: 299

I love Rich Hickey, Clojure and Haskell and I get it when he talks about functions and the unreliability of side-effecting code.

However I work in an environment where nearly all the functions I write have to read from the database, write to the database, make HTTP requests, decrement a user's balance, modify a frontend HTML component based on a click action, return different results based on the URI or the POST body. We also use PHP for the frontend, which is littered with functions like parse_str(), which modifies an object in place. All of these are side-effecting to one degree or another.

Given these constraints and the side-effecting nature of the logic I'm coding, what can I do to make my code more reliable and function-able?

© Programmers or respective owner

Related posts about programming-languages

Related posts about web-development