Wednesday, October 7, 2009

Functional vs. OO Design

This chapter compared the modularity and flexibility of functional programming languages vs. object oriented programming languages. The author admitted up front that his knowledge of functional programming was limited compared to his knowledge of object oriented, and I think that showed in the comparisons. I think his treatment was fair on the areas he covered, but a functional expert may have thrown in some more areas for comparison. He did a great job of showing how object oriented design can cleanly address some issues found in functional programming and perform on par with the functional strengths.

Functional programming can be quite flexible in that operators and parameters are treated in the same manner, making it easy to extend. However, object oriented does a better job of modeling problems, and reduces the amount of programming through inheritance, something not available in functional programming.

Of course, I have much more experience as well with object oriented program languages then functional, which is limited to some Lisp. I think it is most useful for when formal verification or other analysis is need on the code, as it provides a clean way to automate the process due to disallowing side effects.

I had not played before with Agents in object oriented design, and found the solution fairly elegant as well.

No comments:

Post a Comment