Dev Blog: Functional Programming

A strange piece of advice I might give indie devs who know the basics of coding might be to check out functional programming.

The biggest, simplest leap that it introduces is the idea of being able to pass functions themselves as objects.  Thing is, lambda expressions are really confusing to a lot of people at first, but frankly I use them all the time at work, and regularly in Mech Retriever.  C# has some fairly nice syntax for lambda expressions, too.

Why would I specifically recommend it to an Indie game dev?  Because I’ve strongly advocated Refactoring and Clean Code for them as well.  If you’re the only one working on a project, or one of only a few, it’s all the more important to take the time to clean up the code–because there’s no one to help compensate for the reduction in speed that eventually comes with bad code.  And there’s a ton of problems that end up requiring way less code to solve if you pass in functions as arguments to other functions.  I use it particularly often with Unit Tests in Mech Retriever–usually with the Action or Func syntax.  I define what action I want to perform on a UI Entity, so I can let test support classes handle boiler plate code, and focus on the Renderings I expect to occur in that scenario.

Like, Share, Subscribe, or Tweet us!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s