Now, I've never used Lisp in my professional life, however, I began to notice that some of the habits I picked up while programming in Lisp were creeping into my daily programming and were actually helping me out quite bit. In functional languages, side-effects are "generally" avoided. (I say "generally" here since, to my knowledge at least, some side-effects seem to be unavoidable—such as I/O operations, for instance). For anyone new to the term, a side-effect occurs when the state of your program is changed from within a function (procedure, method...whatever). This happens quite often in normal procedural and OO programming, but in functional programming it is avoided as much as possible. After programming in Lisp for a month or two, I noticed that in my daily life I had begun to avoid side-effects in my programs whenever I found it possible to do so. This allowed me to create programs that were much easier to unit test, since all I had to do was check the function's output to know that it worked correctly. Also, since no undesired changes occurred inside of my functions, my software immediately showed a vast reduction in bugs, not too mention that purely functional code is also immediately thread safe. Being able to test each function as I wrote it, and prove that it worked correctly without exception, meant that my programs would work almost the first time I integrated everything and r
11/29/2005
More Free Love for Lisp
Christopher Roach posted another installment about learning Lisp. This time he talks about how learning functional programming via Lisp made him a better programmer:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment