views:

292

answers:

1
+2  Q: 

HaXe Web Framework

Hi,

I'm just beginning to look at the HaXe language, primarily for flash development, but once I'd seen what Neko can do, also the desktop and web server side of things too.

I sort of have my head around the flash side of things - just need to play with it a bit more, but I'm a bit lost when it comes to creating an MVC web site with it.

What would you suggest when it comes to building the web site ( this would be just a basic site with different sections to understand controllers/actions/ids )? I know that PureMVC is a fairly well established framework, but in this case how (if) could it be implemented?

I'm hoping for something along the lines of ASP.NET MVC, which I've breifly had a look at, but not had time to use properly.

Many thanks for any advice.

+1  A: 

Haxe is good for it cause MVC is very natural for OO(not object capable alike PHP). Keep in mind MVC is more of a concept, so it very general the way its implemented is up to you.

Things to remember. Haxe has single entry point, meaning all your urls have to be pointed to a certain haxe(php) file which has "main" class/function. (You have to make a simple .htaccess which would repoint all urls to this "main" function) Side notes: you can compile each file to be separate app kind'a like php but I would not recomended.

This entry point should eventually initilize some class let's call it a dispatcher. So called dispatcher will identify the url/uri php.Web.getURI() and based on that will fire up apriopriate class/function and perhaps with some parameters from url.

Another thing to remember is that you cannot do code spaghetti (a'la PHP). You have to use some sort of templating enginge or write a simple one yourself. Haxe has two template engines one is haxe.template (very simple) and another one is Templo (very decent and powerful).

With that in mind you should be able to start cracking the subject ;]

Marek Mollin
Thanks Marek,I've trawled the haXe forums and mailing lists, and looked at haXigniter, and came to the same comclusion. I may give PureMVC a go at some point, but as a lesson, I'm forcing myself to understand how to actually build a simple MVC framework myself.I've already, using the same points as you wrote above, written a simple website, using templates (.mtt files), url rewriting to a single main entry point, and currently using static html files for content, just to see how everything fits together. I must say, I'm liking haXe very much.
Paul
PHP as a langage is a horror! Haxe organises things (the output however seems clouded but I let that be... once you try to read those files you will see the common tricks used by the haxe 'compiler' and you will be to put changes directly to php if you wish) I mean its wonderful to just have arrays like array.push();There is still much to be done in Haxe. I am awaiting SOAP. Other than that keep up the good work. PureMVC is confusing with names - try to ignore the naming and learn as much as possible avoiding to think about names. Cause 'proxy','mediator' may be misleading!
Marek Mollin