Functional programming in Games Industry?

Started by
34 comments, last by Rebooted 17 years, 7 months ago
I'm doing a Computing with Games Technology module and in the final year we are required to pick electives. The ones recommended by the course leaders are Software Agents and Functional Programming. For the latter we will be using Haskell. My question is this... does a Functional Programming language such as Haskell have a serious place in the games industry? I know C++ is the most common language used in the games industry. I've been looking at Haskell and it is bloody hard to get to grips with even with the various online tutorials.
Advertisement
Learning a functional language will, hands down, make you a better programmer in all languages.
Crash Bandicoot used LISP for scripting.
Jak & Dexter used LISP as the base language, and used GOAL (a Scheme-like language based on LISP) for scripting.
It can be good for scripting and AI
You should look at LISP for another functional language
Maybe it will help you understand Haskell
> Learning a functional language will, hands down, make you a better programmer in all languages.

It certainly is more difficult than any other language I've come across.

> It can be good for scripting and AI

Ok this is interesting. I'll look into the LISP thing aswell.
Quote:Original post by spaceJockey123
> Learning a functional language will, hands down, make you a better programmer in all languages.

It certainly is more difficult than any other language I've come across.

Only when you're used to thinking in terms of imperative languages. [grin]

At my university, the first language we learn is ML, a functional language. Then we get Java in the semester after that.
And it almost never fails that those who have never programmed before pick up ML without too much trouble, while those who have already used C++/Java/whatever struggle to understand it.
Quote:Original post by Spoonbender
At my university, the first language we learn is ML, a functional language. Then we get Java in the semester after that.
And it almost never fails that those who have never programmed before pick up ML without too much trouble, while those who have already used C++/Java/whatever struggle to understand it.


I agree. Most of my students (I teach Caml Light) who already know imperative languages will try "the imperative way" and miserably fail, while the innocent will try "the functional way" (the only they know) and succeed.
Quote:Original post by Deyja
Learning a functional language will, hands down, make you a better programmer in all languages.

Why?

I'm learning ML, and at the moment am writing a parser for a WFF in ML for an assignment, and while I find myself understanding more about the functional programming paradigm, and about how I can write much cleaner and more elegant code for some things in ML (and most likely, by extension other functional languages), how will this help me programming in C++?

Just by helping me see more possible solutions for different problems?

PS. By the way, the site I directed you to was written by my lecturer in the subject the assignment is for.

PPS. Why is it that whenever people want to make a note of something in code (my lecturer :D ), or sometimes elsewhere, they use "NB"? It means Nota Bene, right? "Note well?" Well, why was it originally used? Do mathematicians use it a lot?
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
It's just latin. Like IE, which means 'for example' in latin. Or was that EG?

Quote:how will this help me programming in C++?


It gives you another perspective on programming. For example, when you only knew C, you probably wondered 'What do I need OOP for? How can learning it possibly make my C code better?'. Well, it can, and it did. OOP doesn't require language support; it's a design paradigm, not a syntax paradigm. The same is true for functional programming. You can do it in C++ just fine. And, if you are using the standard algorithms, you already are.

Also, C++ Template Meta Programming is functional programming.
I seriously recommend you do take that module and get a good book that teaches you the functional paradigm properly (with haskell as the language used) like Haskell: The Craft of Functional Programming, you cannot just pick this up on a few (online) tutorials and expect to know it properly.

Also you should be aware of the fact that haskell is a purely functional language where as other functional languages like SML and lisp are impure functional language. A purely functional language is one where all expressions/functions are referentially transparent meaning no assignment, no inplace update, the result of a function is always the same with the same input, in other words no side-effects.

Don't let this put you off there are many benefits of having this restriction as you will find out and there is a method of emulating imperative features or stateful computations using monads (you'll read about it).

Another thing that makes Haskell different from many languages is that it is a nonstrict language, meaning that all expressions/functions are evalutaed expressions are evaluated lazily (lazy evalution). This allows for some very powerful/elegant techniques/patterns such as writing infinite data structures, more efficent implementations in certain places, etc, etc.

Put it this way haskell is one of the most elegant & sexiest languages you could ever learn as of current. Learning Scheme is a good complement with haskell too.

Why Functional Programming Matters
Why Haskell matters
The Evolution of a Haskell Programmer (this is something you can measure your haskell/functional knowledge by and have some laughs at the sametime)

[Edited by - snk_kid on August 20, 2006 12:31:49 PM]

This topic is closed to new replies.

Advertisement