Notes on Functional Programming paradigm 3: pros & cons






  • Pros: in functional style the sequence of calls and operations seldom matter while in procedural style it does and this add complexity

  • Pros: in functional style it is easier to change a program because assumptions and statements about objects are absolute, they never change over time. While in procedural style state change and a huge effort is required to avoid unintended consequences. Indeed a major effort in OOP with encapsulation and information hiding is about partitioning the state into discrete little chunks and put it behind a class abstraction to keep track of it and avoid unintended consequences.

  • Cons: in functional style a huge number of intermediate objects are created and destroyed and this has performance implications. For some part of the program this can be a bottleneck, for others not.

  • Cons: the unfamiliarity of programmers about the functional style of representing problems (solutions)

  • Pros: with functional style many problems of parallel programs vanish because the shared data and state does not change

Source: Implementation Patterns, Kent Beck, 2007

See also: Tell Don't Ask, unit tests and mutable state




Print | posted @ giovedì 11 novembre 2010 23:01

Comments have been closed on this topic.