Hi Lorenzo.
For your first question: it makes all sense. The entire OCaml environment is pretty good and complete and you can build stronger and more stable backend thanks to the type system of OCaml (and of course all other functional features, I can be more complete if you want). OCaml allows you to use the paradigm you want: object, imperative of functional. Even if the functional paradigm is the most used. Another good aspect of OCaml is the syntax is very simple.
Second question: Async is always the better way to do requests to databases because access to databases is sometimes slow and it will block your app since the request is not finished. You have two popular libraries for async programming in OCaml: Lwt (part of the Ocsigen project, a web framework entirely in OCaml, https://ocsigen.org/lwt) and Async (JaneStreet, https://github.com/janestreet/async ).
If you comes from the JavaScript community, there are some OCaml to JavaScript compilers (js_of_ocaml: https://ocsigen/js_of_ocaml and BuckleScript: https://github.com/bloomberg/bucklescript ). You can write OCaml code, compiles it in JavaScript and use the entire JavaScript environment. There are some work in progress to create bindings to popular NodeJS packages to facilitate the migration in OCaml for JavaScript developer.
Danny Willems.
On 09/08/2016 08:52 AM, Lorenzo Pomili wrote:
Hi all,
I work as front end developer in JavaScript developper and I'm trying to learn to work in OCaml and in general with functional programming so I opted for backend,
first question: make backend in OCaml have sense? or is kind of project who don't fit with functional paradigm?
second question: first thing I'm trying to do, is simple wrapper for database calls but I'm not sue if is better make calls sync or async?
regards
Lorenzo