Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Pierre-Yves Saumont: Functional programming for game development  RSS feed

 
Benjamin Johnson
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I was just wondering if you had any advice for using functional programming in game development? It seems that Object Oriented Programming is pretty dominant in this field because the very nature of OOP makes it more intuitive for creating video games. Do you have any suggestions for when it might be more appropriate to use functional programming for video game development? Are there limitations for game development imposed by OOP that functional programming overcomes?

Sorry for such a vague question! Any opinions are welcome!

flpymonkey
 
Pierre-Yves Saumont
Author
Ranch Hand
Posts: 103
17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not at all a specialist of game development, but I think functional programming can benefit to all types of programming. At least, some principles apply. Being purely functional at any cost is an interesting brain challenge. A very interesting one, but when it comes to productivity, you have to use the best tools at you disposal. Separating pure functions from effects is always a good thing, and many good imperative programmers do it without thinking about being functional. Using immutable data structures brings safety, but there might be a performance cost if you work with libraries and/or frameworks that impose different data structures. Pushing abstraction to the limit is often useful in order to really understand the true nature of the problem you are handling, but it is sometimes more efficient not to push abstraction too far. The important thing is to see the abstraction in order to be able to make an educated choice, instead of reproducing "best practices" again and again. As Erik Meijer, once said, "Think like a fundamentalist and code like a hacker". (If you don't know who is Erik Meijer, search for him on Youtube!)
 
Campbell Ritchie
Sheriff
Posts: 55334
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and welcome to the Ranch
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!