Serenity web framework - early feedback wanted

Robert Clipsham robert at octarineparrot.com
Fri Dec 31 09:59:36 PST 2010


On 30/12/10 20:12, Jacob Carlborg wrote:
> I have to say that I'm a bit septic to all/most web frameworks, because
> in my opinion they're trying to create a Rails implementation in the
> given language but they all fail due to the language is not powerful
> enough. But I think you have taken a different route and created an API
> that doesn't try to be exactly like Rails, which just might be the right
> solution to create a good web framework in another language than Ruby. I
> think it looks interesting, a coupe of questions/comments:

That's an interesting opinion - having never used ruby or rails I can't 
really comment on it, guess I should probably take a look.

> * In example.models.Home, if I understand things correctly Home is a
> model and Post is the actual representation of the table? If that's the
> case, why the separation?

That is correct. The main reason for the separation is that I feel you 
should be able to use the ORM without having to use the MVC parts of the 
framework. I guess you could argue either way - it would be possible to 
expand the functionality to allow models to pose as table schemas, I 
haven't really thought about it.

> * Is it always wise to create a model?

Nope, which is why there is an additional template, 
registerController!(MyController), which doesn't require a model - I 
added in the additional arguement to save a few lines of code for what I 
forsee being used fairly frequently.

> * Shouldn't Controller.view return Document instead of HtmlDocument?

Possibly. This is a bit of the framework I'm still not complete sure how 
it will end up being implemented - It will eventually need to be able to 
return JSON/XML as well, so you're probably right here.

> * You list removing the templating system as a feature but this will
> loose the separation of the view code (the view) and the code for the
> logic (the controller)

I had this very discussion with a couple of people, one of which has 
written a full MVC framework, and I managed to convince them that 
there's no need for it - it makes sense if you're embedding markup some 
how, but I don't see the point of something like:
----
HtmlDocument view()
{
     View v = new View;
     view.display(model.getPosts());
}
----
All that achieves is an extra class you have to create, and when you're 
constructing the html etc with code rather than mark up anyway, why 
bother? Feel free to argue the point though, I'm not completely against 
it, just seems unecessary to me. (I guess I should probably call it an 
MC framework rather than MVC?)

> I'm using D1 and Tango but I have to say that I think D2 as some nice
> features that will make it possible to create an ORM implementation with
> quite a good API (opDispatch, template this parameter, Variant to
> mention a few).

D2 does have some nice features indeed. My problem with it is, within a 
week of starting using D1 again I'd hit several compiler bugs in dmd and 
ldc (some of which I patched, some I worked around). D2 has a lot more 
features (a lot of the more useful ones are incomplete), and the one 
time I did try it hit a lot more issues in the same amount of time. Add 
to that an incomplete/buggy standard library, the lack of a D2 fastcgi 
wrapper, the lack of support for anything other than 32 bit 
architectures (I know, I know, this is changing)... For my own sanity 
I'm sticking with D1. This isn't to say I'm completely against a move to 
D2, it's just not worth the effort at this point though.

> BTW, how is it working out with doing web development in a statically
> typed language?

Ask me again in a couple of months when I've got a website powered by 
it. I've gotta say from what I've done so far it's actually far nicer 
than web development I've done in dynamically typed languages, we'll see 
how that works out though. The main thing that's lacking is runtime 
reflection, which is *incredibly* poor and underpowered, I had a 
brainwave with respect to this though - I'll see how it works out though.

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list