Simple HTML for boadgames in Elixir

199 views
Skip to first unread message

Torben Hoffmann

unread,
Apr 13, 2015, 3:06:08 PM4/13/15
to elixir-l...@googlegroups.com
Hi,

In the Erlang world there is Nitrogen (nitrogenproject.com) which uses JQuery to create a lot of nice HTML.

I can see this working for a thing like Yahtzee, but after that I imagine that it would become clunky to do more advanced UIs. 
(I know I have to write a bridge to Nitrogen since it relies heavily on records, but that is doable.)

Are there any libraries for this in Elixir?

I found https://hex.pm/packages/execjs, but that requires me to write the JavaScript myself - doable, but it would be a lot of work to create a library around that from scratch - the thing needs to be in Elixir, see below.

The context is my Junior Beamster Elixir course (beamster.org/jb) where I would like to make a GUI for Yahtzee, but going further also do other boardgames. So far my plan has been to switch to Elm, but if I could avoid that and stay in Elixir it would make it so much easier. And I would be able to introduce GUI a lot earlier, which would be a huge motivator for the kids.

Cheers,

Александр Сальников

unread,
Apr 21, 2015, 9:38:28 AM4/21/15
to elixir-l...@googlegroups.com
You can use n2o framework. It is a new version of nitrogen rewrited almost from scratch by Maxim Sokhatsky. 
It is perfectly compatible with Elixir (as any other Erlang prog tbh). 
I personally run it. Elixir compability is also stated on their website. 
It is quite good. 
The only probably problem is fast development sometimes breaking back-compability. 
But some say that is not a problem but a sign of becoming much better.

понедельник, 13 апреля 2015 г., 22:06:08 UTC+3 пользователь Torben Hoffmann написал:

Wojciech Kaczmarek

unread,
Apr 21, 2015, 11:17:13 AM4/21/15
to elixir-lang-talk
Hi,

I have a project called Rockside, https://github.com/herenowcoder/rockside, which aims to blend many ideas from both Nitrogen & Seaside, and is consequently 100% vaporware :D

Having said that, I will mentally remember you as one of the people who would be interested if/when something really useful gets released.

cheers,

Wojtek


--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/CABf3pCkwHM6%2BnkYKsoRXNH9mtN8a2VF-cP-B46fLn1W5Cdy8sA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Torben Hoffmann

unread,
Apr 21, 2015, 12:42:49 PM4/21/15
to elixir-l...@googlegroups.com
N20 is a good suggestion.

As for its Elixir compatibility I have not been able to dig up an example of how it would work.
N2O relies on Erlang records - just as Nitrogen - so I would expect having to write some code to bridge that. It seems that https://github.com/erlang-synrc/n2o.ex/blob/master/lib/sample/n2o.ex might do exactly what I need, so I will have a look at that.

Thanks for the hint!

Cheers,
Torben



--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Torben Hoffmann

unread,
Apr 21, 2015, 12:49:12 PM4/21/15
to elixir-l...@googlegroups.com
So now I am mentally associated with vaporware at your end?!?! ;-)

I'm too lazy to dive deeply into Seaside. Could you provide a short explanation of what it would add to Nitrogen/N2O? Lazy, but curious!!

Cheers,
Torben


For more options, visit https://groups.google.com/d/optout.

Wojciech Kaczmarek

unread,
Apr 22, 2015, 10:47:37 AM4/22/15
to elixir-lang-talk
Hi,

On Tue, Apr 21, 2015 at 6:49 PM, Torben Hoffmann <torben...@gmail.com> wrote:
So now I am mentally associated with vaporware at your end?!?! ;-)

Well yes! I forgot to add - if you don't mind :]
 
I'm too lazy to dive deeply into Seaside. Could you provide a short explanation of what it would add to Nitrogen/N2O? Lazy, but curious!!

Very good question. I will answer shortly, still it's a wide topic.

What was my experience with Nitrogen is that it required quite amount of boilerplate when creating own elements (please note these are "Nitrogen elements" not w3c html elements - they are rather equivalent to Seaside components mentioned below, having its own behavior as well [triggering/reacting on Nitrogen events]).

Seaside comes with its own metaphors - canvas, brushes and components. Wrt to web application, canvas is an abstraction you draw on to finally produce html+js output for your browser; brush is a tool you draw with - like a specific html element; component is a logical building block like my_favourite_login_form or some div with jQuery animation which happens in specific conditions and generates new conditions - ie. new "state" of the web app.

Please note Seaside comes from Smalltalk where you can subclass everything to the points of craziness ;), so no easy way to implement things in FP language in a similar way. But what I wanted to be Seaside-like was the nice syntax of the code you end with when writing web app, and kind of reusability of the components.

One of the ideas was also to just be inspired with some general ideas from Seaside, but technically just use Elixir macros and protocol to overcome Nitrogen's boilerplate when creating own components.


As I didn't come up with a decision yet, there's no code, so the vaporware :D


Seaside is also supporting a thing called continuation-based web apps but I didn't want to go that route.


cheers,

Wojtek

 
Reply all
Reply to author
Forward
0 new messages