Monday, May 16, 2011

Picking the Right Programming Language


I actually worried a little bit when I started coding Forge in Java.  I thought, “Was Java really the best language for this project?”  “What if people didn’t have Java installed on their computers?”  Thankfully I have never had an email telling me that they had to install Java.  I presume some people did have to install Java but hopefully it installed without any problems.  After a little analysis-paralysis I chose Java and starting coding furiously.

In the end I chose Java because it was the language I knew the best.  Java isn’t perfect but no language is.  Java ended up to be a good choice because Forge also runs on Mac and Linux.  The remarkable thing is that I didn’t intend for Forge to run on any other operating system other than Windows.  Being able to be run on Mac and Linux was a happy accident.

Choosing the right programming language also depends on your goal.  If you want to make a browser based game you can use Flash or Java.  (Forge could be made into a browser game but it would take a lot of work.)  If you are trying to squeeze every CPU cycle, you will probably want to use C++.   Java is pretty fast but C++ is probably the fastest language (other than assembly of course).

Various Magic projects use various languages.  Incantus is written in Python.  Wagic uses C++ in order to effectively run on the PSP (Playstation Portable).  MagArena uses Java and although it uses min-max (a CPU intensive algorithm) it employs various speed-ups and it runs well on my 750 MHz machine.

In the end it really doesn’t matter which programming language you use. 

p.s.
If your language has any type of certification, I would say go for it.  Even if you just study and never take the test, it would really help you.  Studying helped me learn a bunch of esoteric stuff that is generally unimportant but sometimes very important.  By knowing a language through and through, you will be a better, faster programmer.

5 comments:

Mike said...

I wish someone would use objective-c so I could play mtg on my iPhone...

forum widget said...

when i was a programmer in C++ at first i wasn't sure what am i doing there, but after you get the hang of it, all other languages became much easier !

Forge said...

Once you understand one computer language, the others aren't too hard. Granted some languages like Lisp are unique and aren't similar to languages like C.

Forge said...

I would love to develop a trading card game for iPhone and Android but I would probably have to create the trading card game myself.

Anonymous said...

I hate to say it, but you got the programming language completely and utterly wrong. If you stop and think for a second, you'll realize that the anything-affects-anything game mechanic of magic does not, and indeed cannot, map onto an object-oriented language in any way, shape or form. OOP is not expressive enough to encompass complex object interdependencies though, judging by the fact that your app does work, I guess it can be massaged to be good enough in the general case.

As to what language is best, the answer is obvious: a DSL. And since you like Java, I guess MPS would be best fit in this particular case.

I'm only joking, of course. Only a dozen people on the planet can probably grok MPS reliably, so I'm suggesting it half in jest. Still, it sure beats trying to go functional, messing with message passing or agent-based systems. Because those are dead ends, too, unfortunately.