Monday, March 14, 2011

Functional and Object Oriented Programming

In the past, I've talked about integrating functional and object oriented programming. I still feel like that's a great way to produce clean code.

This article addresses a few more aspect of functional and object oriented programing, including Bottom up vs Top down design.

Object Oriented programming often encourages thinking about code in a top down way. On the other hand, functional programs tend to be bottom up. I've found this to be pretty accurate in the past when I work with both paradigms.

One particularly interesting point made in the article is about reusability. Specifically, the article claims that bottom up code is inherently more generic because they are built before their exact uses are explicitly planned and encoded. I've never really thought about it like that, but it makes sense. In general, functional languages provide you with a lot of resources to create cleaner, more reusable code. First-class functions are probably the biggest convince they offer for creating clean code. Of course, reusability isn't always the best goal anyway. Reusable code just happens to also have a lot of other very desirable properties. 

No comments:

Post a Comment