7

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.

Joe Cannatti
  • 4,989
  • 5
  • 38
  • 56
  • 1
    What benefit do you want from Rails? If you mean use it for the user account creation and searching for people to play with etc I can understand, but if by 'front end' you mean the playing of chess, I don't see how it would help you. Like, if I was developing a CRUD-ish database-driven web app, then Rails' ORM would jump out at me and scream "I BENEFIT YOU AND YOUR PROJECT"... for something as 'real time' as chess, I don't feel like I see what Rails will do for you. Then again, I've only read about Rails extensively, so I'm talking out my ass and look forward to being proven wrong ;) – Richard JP Le Guen Jan 20 '10 at 03:25
  • What are your definitions of "front-end" and "engine"? Your question is kind of vague. – Sasha Chedygov Jan 20 '10 at 04:16
  • These questions don't make much sense. Do you want to build an application, no matter which, with that design, or do you specifically want to build a chess application? – Daniel C. Sobral Jan 20 '10 at 10:58
  • I have an idea for a site that has a lot in common with a chess app. I am asking what the best way to build a chess app is. Regardless of design. Sorry for the lack of clarity. – Joe Cannatti Jan 20 '10 at 17:59
  • What about Java or .NET? – willcodejavaforfood Jan 21 '10 at 13:24

6 Answers6

7

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
  • 166,841
  • 26
  • 322
  • 407
3

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
  • 36,755
  • 28
  • 133
  • 162
3

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 C. Sobral
  • 295,120
  • 86
  • 501
  • 681
2

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
  • 6,561
  • 1
  • 30
  • 28
  • 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 Jan 21 '10 at 03:24
1

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
  • 476
  • 6
  • 16
  • 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 Jan 21 '10 at 03:22
1

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
  • 11
  • 2