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.

May 2012

Functional Programming is the New Trend

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 (1) | Tags: c++ | Author: Adam Sawicki | Share


2016-03-23 07:42:32
A Man who passes his evening as I had passed mine, may go to bed afterward if he has nothing better to do. But he must not rank among the number of his reasonable anticipations the expectation of getting a night’s rest. The morning was well advanced, and the hotel was astir, before I at last closed my eyes in slumber. When I awoke, my watch informed me that it was close on noon.

I rang the bell. My servant appeared with a letter in his hand. It had been left for me, three hours since, by a lady who had driven to the hotel door in a carriage, and had then driven away again. The man had found me sleeping when he entered my bed-chamber, and, having received no orders to wake me overnight, had left the letter on the sitting-room table until he heard my bell.

Easily guessing who my correspondent was, I opened the letter. An inclosure fell out of it — to which, for the moment, I paid no attention. I turned eagerly to the first lines. They announced that the writer had escaped me for the second time: early that morning she had left Edinburgh. The paper inclosed proved to be my letter of introduction to the dressmaker returned to me.

I was more than angry with her — I felt her second flight from me as a downright outrage. In five minutes I had hurried on my clothes and was on my way to the inn in the Canongate as fast as a horse could draw me.

The servants could give me no information. Her escape had been effected without their knowledge.

The landlady, to whom I next addressed myself, deliberately declined to assist me in any way whatever.

“I have given the lady my promise,” said this obstinate person, “to answer not one word to any question that you may ask me about her. In my belief, she is acting as becomes an honest woman in removing herself from any further communication with you. I saw you through the keyhole last night, sir. I wish you good-morning.”

Returning to my hotel, I left no attempt to discover her untried. I traced the coachman who had driven her. He had set her down at a shop, and had then been dismissed. I questioned the shop-keeper. He remembered that he had sold some articles of linen to a lady with her veil down and a traveling-bag in her hand, and he remembered no more. I circulated a description of her in the different coach offices. Three “elegant young ladies, with their veils down, and with traveling-bags in their hands,” answered to the description; and which of the three was the fugitive of

Post comment

Nick *
Your name or nickname
Your contact information (optional, will not be shown)
Text *
Content of your comment
Calculate *
(* - required field)
STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki