Experiences using oscigen in a software engineering course?

I teach an introductory course on software engineering. During the course students work in teams on projects they define at the semester start. Most of them come up with a project that gets implemented as a web/mobile application. Up to now I’ve let them choose their implementation tools, but I often see projects make very slow progress on the implementation side. Students might take half the semester to have sign-up, login, and sessions under control. I’d rather have them spend more time on more interesting domain, application, or presentation issues. So, I’m considering prescribing the use of OCaml/Ocsigen/Reason for the next edition of the course. Does anyone know of experiences using Ocsigen in particular in teaching?

5 Likes

Hi Marko,

I used Ocsigen Start several times with students and it worked very well.
Ocsigen Start provides a complete application with user management, so that you can focus on the interesting parts of the app. It is intended to quickly build MVP for any app or even to be used in production (for example the Besport social network is based on Ocsigen Start).

Be careful however that your students do not get lost. Ocsigen is using many advanced features and it requires some learning time. I would recommend to suggest that for students only if you feel comfortable yourself with all these concepts, and take time to give an introduction to:

  • Lwt
  • Polymorphic variants, phantom types and html typing with TyXML
  • js_of_ocaml (especially how to interact with JS functions)
  • Multitier programming (Having a look at all the examples provided by Ocsigen Start in a good way to learn quickly)
  • Probably also basis of reactive programming with Ocaml React, as it is used by Ocsigen Toolkit

You can find a complete and concise introduction to all these concepts on that page:
https://ocsigen.org/tuto/latest/manual/basics

Keep me informed of your experience!

4 Likes

I am surprised that they are implementing sign-up. Usually, when working on an MVP, I create a table with prepopulated users, and the authentication just involves a user entering a username, without a password. I could see how session management might take a little time.

1 Like

[Disclaimer: I am new to Ocaml world] is Ocsigen still maintained?.. When I tried to install, it would require downgrade to Ocaml 4.11.2 (I have 4.13.1), and installation (of that particular Ocaml version) fails with compilation error:

# signals_nat.c:198:13: error: variably modified ‘sig_alt_stack’ at file scope
#   198 | static char sig_alt_stack[SIGSTKSZ];
#       |             ^~~~~~~~~~~~~

For backend another good option to look at is Dream. It comes with session management built in: Dream — Tidy, feature-complete web framework

Dream’s extensive documentation and examples should also help students ramp up quickly. Using, say, a local SQLite database (with some convenient SQL support), they should be able to implement session management within a couple of weeks. And its built-in simple templating will let them build UIs quickly, even using GraphQL and WebSockets if they want.

1 Like

@gantsev.denis For me it’s as simple as

opam switch create 4.13.1
opam switch 4.13.1
opam install ocsigen-start

You should file a bug report on the Ocsigen repo.

Of course Ocsigen is still maintained! The Be Sport social network is 100% Ocsigen (Js_of_ocaml, Eliom, Ocsigen Start).

It works well with 4.13.1.
Didi you try with a fresh opam switch?

1 Like

I am sorry, yes, so I opened an issue on ocsigen-start github, and got a prompt reply.
Somehow my global installation is broken, but installing in a fresh empty environment is all good!
So everyone can disregard my comment above (probably should be deleted)

To confirm, installation works correctly from empty environment with Ocaml 4.13.1!

That version does not compile on distributions which have too new of a Glibc, like Fedora 35. You need at least OCaml 4.13.

On this topic, we currently have an improved fix under review in the development version of OCaml . Once this improved fix has been merged, the plan is to backport the corresponding patch to the older versions of the compiler distributed with opam. (The underlying issue is that glibc 2.34 broke posix compatibility, so there is no way to compile an older OCaml version with glibc 2.34 without such patches.)

3 Likes

To which range of compilers? All the ones in OPAM sounds like a rather large effort.

At the very least, @dra27 plan is to backport the fix to OCaml 4.09 and later. I haven’t looked how far back it is sensible to reuse this patch.

At a glance, the patch will go quite cleanly on 3.08 :slightly_smiling_face: As @xavierleroy noted in the original fix in 4.13, OCaml had quite happily had that code in the native runtime for 20+ years!

4 Likes