Functional Programming is the New Trend

Warning! Some information on this page is older than 5 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

# Functional Programming is the New Trend

May 2012

Some time ago I've written about data-oriented design as a popular trend among game developers, opposite to the belief that object-oriented programming is the silver bullet for all challenges and complexities of programming. Mike Acton, Engine Director at Insomniac Games and the creator of #AltDevBlogADay, is probably the biggest evangelist of this idea.

Now I can see that functional programming is a concept gaining popularity and it seems to follow similar mindset. Of course we won't start coding our games and programs in Lisp or Haskell tomorrow, but some of the ideas coming from functional languages can be applied to thinking about our everyday C++ code, instead of seeing design patterns, singletons and class inheritance everywhere. This can mean, for example, making data const (immutable) wherever possible and writing functions as pure - returning processed data that depend only on input data and not mutating or accessing any global state. This makes code simpler to read and understand, debug and unit-test, as well as to parallelize.

I've seen some voices in gamedev advocating that functional programming is the future even years ago. I can remember slides from some conference about it, I can't find it now though. But recently more and more programmers seem to be interested in learning some functional languages, writing about it, like explaining what the monad is etc. Some really recent, interesting blog posts about applying idea of functional programming in the real code:

Life Without Objects by Chris Turner
(Almost) functional programming tips for C++ by Bryan St. Amour
And finally, a post from #AltDevBlogADay by John Carmack: Functional Programming in C++.

By the way, it really impresses me how despite all his experience, fame and success, Carmack still tweets and blogs about programming, down to its dirtiest details, instead of writing about management, leadership, enterpreneurship, money, psychology, recruitment etc., like many other professionals do.

Comments | #c++ Share


[Stat] [STAT NO AD] [Download] [Dropbox] [pub] [Mirror]
Copyright © 2004-2017