views:

278

answers:

6

I am building a site that has a lot in common with a person-on-person chess site. I was thinking of using Rails for the front-end(User Registration, Navigation, etc) and something like Scala or Erlang for the engine(Game state and maybe AI). I was wondering -

  1. Is this a good situation to use that type of design?
  2. How exactly would be best to divide up the functionality between the components?
  3. How would they best communicate with each other?

I'm open to any technologies or ideas.

+2  A: 

I would start by reading http://www.htdp.org/ How to Design Programs. The questions you have asked are very broad and difficult to answer without prefixing statements with "I believe that..."

I would code it in clojure (but that's just me).

Joshua Smith
You could certainly do a lot worse than clojure. I love functional programming but am not really into lisp. But if lisp speaks to you, clojure gives you a modern lisp w/ easy use of industry-standard libraries.If you don't want to wear out your 9 and 0 keys, scala has a lot of the same features as clojure, in a rather different flavor. But yes, please for the love of god use a modern language.
Justin W
+6  A: 

If you're using Rails for the front-end, why not use Ruby?

If you like the idea of using Scala, why not use Lift for the front-end?

Rex Kerr
+1  A: 

Chess is turn-based, and has a very simple board that can be handled with HTML and/or Javascript enhancements - so the basic model flows quite nicely with existing web frameworks.

With this in mind, Rails is a great choice for creating a web-based application. Rails is not just limited to crud applications, and in fact I think can write your entire app in Rails/Ruby - you don't really need to have an external engine.

Within the browser space, polling for turn updates can be done using XMLHttpRequest and a database can maintain the current game and turn state.

Toby Hede
+3  A: 

Looks like a simple Lift application to me. I'm not experienced with Lift, mind you, but it doesn't seem particularly more complex than the chat application that is so often demoed.

Daniel
+1  A: 

I'm currently developing a suite of online games, using Scala. It's been absolutely fantastic - my game logic is much easier to get right with the static typing etc, and dealing with server/client protocol (a flash client, in this case) is made simpler via the use of Google Protocol Buffers.

If you're a huge fan of RoR, by all means use that. I think most statically typed languages are terrible to program websites in (Java, I'm looking at you here), but Scala gets rid of 90% of the pain, and gives even more safety.

Of course, it might not be your cup of tea. But I'd try just doing the entire thing in Scala, and adding another layer if that doesn't quite do it for you.

Justin W
Also, depending on what you're doing, you might like Sun's Project Darkstar. Any JVM language can use it, and it makes multiplayer online games a snap to develop.
Justin W
+1  A: 

For question 1 Yes And for 2 and 3 you need to give more information in order to get an answer that could help you.

Now I'm doing something like you but for the front end I'm going to use Grails. The reason are very simple: I like Grails, Scala and I want to mix them :)

Ale