Select Page

In an object-oriented approach, one represents concepts, real or abstract, as objects.  Like the objects you see and imagine around you, they can have behavior and state, and can collaborate together to represent a problem or system.

In a functional programming approach, one represents a problem by breaking it down into small units of computation that act on information passed to them, and which can in turn output some result. Here one is more modeling or representing processes and the relationships between them.


Consider a ham and cheese sandwich.  In an object-oriented approach, one would identify the individual concepts (objects) involved (bread slice, butter, ham, cheese, knife) and for each consider what they know, what they do, and who they collaborate with.  One ends up with a representation or model of a ham and cheese sandwich.

In a functional programming approach, one would instead identify the steps used to make the sandwich.  The sandwich would emerge by passing it through a series of processes, each of which applied ingredients or some transformation.


Representing a recipe, transformations, or processes suits a functional programming approach well.  But what about an inventory management, accounting system or an aircraft control system?  Can you identify all the processes? How do you decompose such a complex system? In this case it is much easier to identify the concepts as objects and model them independently, then model how they collaborate to (for example) fly the aircraft.

See also:

Share This