Re: [Vala] Need some feedback for Valum, a web micro-framework!



Le samedi 27 juin 2015 à 11:51 +0000, Al Thomas a écrit :



From: Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
 Sent: Saturday, 27 June 2015, 3:37
 Subject: [Vala] Need some feedback for Valum, a web micro-framework!
   
I am working on a web micro-framework this summer as part of an
academic project. I plan to release a stable and production-ready
version by the end of this summer and use it to build an application.

The repository is hosted on GitHub: 
https://github.com/valum-framework/valum

You may also want to review the documentation: 
http://valum-framework.readthedocs.org/en/latest/

If you are interested into the project and don't mind playing with it 
a
little, I would gratefully take some of your feedback because I am
stabilizing the APIs for good in the incoming releases.


The project is interesting.
I like the idea of using GLib.Resource to server static resources ( h
ttp://valum-framework.readthedocs.org/en/latest/recipes/static
-resource.html ). This could potentially be a static content server 
at the edge of a web application. The idea raised a few questions.
If a VAPI for libsass ( https://github.com/sass/libsass ), the 
compiled CSS pre-processor, was to be written would this integrate 
easily with Valum? It would be a nice workflow for development to 
change a SASS file and to have the resources re-compiled almost 
immediately.

That will depend on the complexity of the code, but I am pretty sure
that if it gets binded, I could write a Converter (
http://valadoc.org/#!api=gio-2.0/GLib.Converter) to compress a CSS
stream.

Resources can be bundled separately and loaded dynamically with 
https://developer.gnome.org/gio/unstable/GResource.html#g-resource-load
, so it would be possible to change them at runtime.

Is there a mechanism for modules to be swapped out at run-time? For 
example the updated static content module has been tested and passed 
in development then the module is uploaded to the server and is made 
immediately available using a mechanism such as inotify on Linux to 
get Valum to reload? Although I'm not sure of the possible security 
implications of this.

Modules is just a pattern to simplify and decouple an application in
reusable pieces, so I have never thought about hot plugging them.

I note one of your examples uses Genie ( https://github.com/valum
-framework/valum/blob/master/examples/app/main.gs ).This is good for 
me, but again I wondered how modular the framework is. I got the 
impression Valum modules ( 
http://valum-framework.readthedocs.org/en/latest/module.html ) were 
compiled into a single binary or are they loaded at run-time?

The Genie example is broken...


The framework uses what looks like request and response objects, 
which I think is pretty common. The docs mention middleware ( http://
valum-framework.readthedocs.org/en/latest/router.html#middleware ). 
Have you looked at the design process followed by the PHP Framework 
Interoperability Group HTTP Message interfaces that they recently 
released as PSR-7? Some useful links:
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7
-http-message-meta.md
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7
-http-message.mdhttps://mwop.net/blog/2015-05-18-psr-7
-accepted.htmlhttp://mtdowling.com/blog/2014/07/03/a-case-for-higher
-level-php-streams/http://srcmvn.com/blog/2015/02/18/psr-7-and-the
-future-of-php/http://dracony.org/replacing-controllers-with
-middleware/https://mwop.net/blog/2015-01-08-on-http-middleware-and
-psr-7.htmlhttps://mwop.net/blog/2015-01-26-psr-7-by-example.html
There is a useful discussion on the use of streams and it now has a 
separate interface. Also the response object is immutable.It looks as 
though middleware is the way Valum intends to handle things like 
authorization.

I am a bit familiar with PSR-7, but I will surely read it just to see
what lacks in the request-response model.

Middleware will serve many purposes and I like the design I have put on
table. I have already a few prototypes and I will release them in the
next minor release.

Finally how flexible is CTPL as the templating engine? Jinja2 and 
Twig are commonly used with Python and PHP respectively. It looks as 
though node.js has plenty of npm modules implementing aspects of 
these. Does/will CTPL be able to provide such functionality in future 
or does Valum allow another templating engine to be swapped in? 
Templates typically follow the composite pattern ( 
https://tiles.apache.org/framework/tutorial/pattern.html ). Although 
the Scala Play framework takes an interesting approach ( 
https://www.playframework.com/documentation/2.2.x/ScalaTemplates ) 
that seems similar to CTPL at first glance. Is CTPL similar to Play 
templates? It would be nice to have an example of site/section/page 
in the docs for Valum. So a single template is used for the site, 
this includes a sub-template for each section of the site, then each 
section is made up of individual templates for different types of 
page in each section. Is site/section/page possible with CTPL?

CTPL can do certain things like passing variables, looping and
branching, but it lacks some features like filters, maps and
inheritence (or just embedding).

It's not even comparable to Twig or Jinja2, but it works and it can do
some of the job.

I plan to write a Mustache implementation, but for now I think that the
best thing the framework should focus on is its ability to describe web
services. The code will be hosted here: 
https://github.com/valum-framework/mustache-glib

We will keep CTPL integration for a while and I think that a good
templating solution shouldn't require any particular integration, but
be usable on its own.

All the best for your project,

Thank you again for your feedback, it was truly helpful!

Al



   
 
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]