Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell or Erlang for a constraint solving course scheduler

I am looking for a new project of my own: I would like to write a course scheduler, figuring out a course scheduling with a optimal allocation of courses to rooms and times. The problem is to solve constraints, for instance: no overlapping in space and time, no lecturer teaches more than one course at the same time, feature requirements for a certain course etc.

I am looking forward to write a two or three component architecture:

  • front end: web interface (AJAX)
  • something in between to hold and manage the data: database (?)
  • back end: course scheduler

Basically, the web interfaces takes the user requests, for instance entering the data, requesting the course scheduler and the course scheduler would load the set of courses and resources and try to figure out a optimal course allocation.

Why do I want to use a functional programming language? Because I think they do best in checking constraints with very few lines of code.

So my questions are:

1) Taking the front end into account, would it be easier to use Erlang or Haskell? I've read some blog snippets about Erlang vs. Haskell, but that does not help very much. Has anyone an opinion with respect to this special project?

2) Do you think it's useful to use a database for sharing the data after all? I am afraid of the mapping between ER and types used in Erlang/Haskell. Are there superior ways of storing the data or will it a lot easier for me, compared to ORM paradigms used in object-oriented language?

like image 650
Konrad Reiche Avatar asked Jul 22 '11 20:07

Konrad Reiche


2 Answers

My advice: pick a language and get coding! There are plenty of libraries that make interfacing with databases and writing webapps painless in Haskell, and I'm sure the situation is similar in the Erlang world. Anyway, the interesting and difficult problems are almost surely going to arise elsewhere -- in some place you can't predict right now. So get to those problem points as quick as you can, and start hammering away at them!

Good luck.

like image 57
Daniel Wagner Avatar answered Sep 24 '22 03:09

Daniel Wagner


This is most likely a very computationally expensive problem, unless you're scheduling for a small school. So speed of code will be important.

Erlang's creators and supporters have said many times that their main goal is not fast programs (parallelism -- breaking a problem into small pieces, to compute faster), but for concurrency -- running many instances of the same computation or action. (I can find supporting quotes if you're curious).

I would recommend Haskell because your problem is mostly in the domain of pure computations, not side-effect-heavy.

Also, to follow up on what @Daniel Wagner said, Haskell and Erlang really aren't quite the same in terms of libraries -- Erlang doesn't really have a centralized library home, like Hackage or CPAN.

Good luck!

like image 26
amindfv Avatar answered Sep 27 '22 03:09

amindfv