#1660 client side fantom

eigenfunction Fri 30 Sep 2011

I have been evaluationg some client side technologies lately to use on a personal project. I want to be able to use an erlang/scala backend. After some googling, 3 candidates definitely stood out for my needs.

1) the echo web framework

PROs: The java version of this framework combined with scala and sbt makes for some of the best development experience you can have while creating statically typed javascript components. You start sbt with ~jetty-run, you make a change in your source code, hit reload in the web browser and BAM! your changes are there.

CONs: You can't choose a different backend technology than java.

2) sproutcore

PROs: Apple uses it on its products(icloud)and it is Backend agnostic

CONs: Everytime i see OOP being forced into js, I stop reading. This is how you extend an object in sproutcore SC.Object.extend({...}). I can't do that. Plus, it is not statically typed.

3) fantom

I like what i have seen so far after running the javascript examples. But the "code change + reload cycle -> change applied" does not work. It seems fantom is tied to wisp. In fact, i wouldn't mind if i was certain that fantom could process as many requests as scala. Reading the threads seem to indicate the contrary.

My questions to the fantom experts:

  • Is there any possibilty to do hotcode reloading in dev mode in fantom à la sbt?
  • What is the performance of fantom in a multithreaded/multi sessions environment? You don't need to give me any hard numbers. if you can tell me that it's good enough for most cases, I am good with it.

DanielFath Fri 30 Sep 2011

Did you try tales? It works pretty nicely I think and has hot code swap/reload (it swaps all classes on save).

brian Fri 30 Sep 2011

Is there any possibilty to do hotcode reloading in dev mode in fantom à la sbt?

It is possible, but it really a function of how you wire things up server side. For the example/js/demo is hot reloaded.

It seems fantom is tied to wisp

This isn't actually true. The compiler just compiles Fantom into JS, what you do it with it is up to you. Wisp just happens to be an easy way to get the server side wired up easily.

In fact, i wouldn't mind if i was certain that fantom could process as many requests as scala

I am not sure what this means. Wisp is a pretty high performance http server, although it uses the classic model of a thread (actor) per request. That is good sometimes, but sometimes an event based server might be better. But you can use whatever web server you want - you don't even necessarily have to run Fantom on the server (although presumably you would need Fantom to compile the JS somewhere in the architecture).

eigenfunction Fri 30 Sep 2011

@DanielFath Thx for the tip. I think tales is a powerful framework. And i like the idea of statefull pages. It reminds me of my days writing Apple Webobjects applications. It got IMO something right: it seems to have accepted javascript from the beginning. The javascript thing is also my problem because, for any reasonable complex javascript application that i have had to write, i ended up with a mess of assembler/javascript code that i was scared to look at. That's the reason why i am looking for a solution that just spits the javascript part. With that being said, i am definitely going to spend some time with tales.

@brian Thank you for your reply and for the clarifications. I don't know how actors are implemented in fantom, but i was wondering if wisp can spawn 100000s of actors the way scala does. I know that in a real application, i would have run out of memory before getting there. But i just wanted to have a point of comparison with scala. In which case, I wouldn't mind using wisp at all. Anyway, after playing with it in the past 2 hours, i believe there are a lot of things to like in fantom. I am just wondering why it does not get enough exposure. With that being said, i have some fantoming to do. Let the adventure begin!

brian Sat 1 Oct 2011

I don't know how actors are implemented in fantom, but i was wondering if wisp can spawn 100000s of actors the way scala does.

I don't know how scala does things. In Fantom each Actor is grouped into an ActorPool and each pool schedules actors onto a thread pool of up to 100 threads. So you can easily handle millions of actors, and use ActorGroups to decide how things divy up across thread pools.

kaushik Sat 1 Oct 2011

Did you take a look at fanquery? http://www.fanzy.net/fanquery It's not perfect yet, but it's a start and we'll make changes as need arises.

Also take a look at tales examples in http://examples.talesframework.org/, none of those examples are built with pure javascript. All with client side fantom + fanquery.

If you use it with tales, you get hotswap reloading for client side js too. Infact, I've been trying to move all my projects to client side fantom, and just loving it :).

Login or Signup to reply.