Apparently people are using the word Swx to refer to the SWX format (an open-source subset of the SWF format) which has an associated application called SWX PHP that might lead to confusion if I continue calling my project Swx.
Coming up with an alternative name for Swx, for some reason, brought back memories of the time Bombay (the city I live in and a name I loved) was renamed to Mumbai. I was toying around with the idea of calling my project Bombay and liked it a lot, so I went with it.
Showing posts with label swx. Show all posts
Showing posts with label swx. Show all posts
Monday, July 27, 2009
Friday, July 24, 2009
Routing in Bombay (WIP)
Default routes
Here are some examples that illustrate the default routes I came up with:
Example Request handler function
---------------------------------------
GET / _home()
GET /foo _show()
GET /foo?baz=qux _query()
PUT /bar _save()
DELETE /bar _delete()
POST / _post()
POST /login _login()
GET /users/ users_home()
GET /users/1 users_show()
GET /users/1?baz=qux users_query()
PUT /users/2 users_save()
DELETE /users/2 users_delete()
POST /users/ users_post()
POST /users/poke users_poke()
I chose
*_save
because it captures both the CREATE and UPDATE semantics of PUT. The other option was *_write()
requiring me to use *_read
instead of *_show
for symmetry but that didn't feel right.*_query
was chosen over *_search
and *_filter
because its asking semantics is generic enough to be used in many different situation than the locating and removing semantics of the alternatives.Catchalls
If none of the above handler functions are found, mapper.lib will fall back on the catchall handler functions.
Request fall-back-1 fall-back-2
---------------------------------------------
* /users/1 users_catchall() _catchall()
* /foo _catchall()
Update July 27, 2009: Renamed Swx to Bombay
Thursday, July 23, 2009
Make your time framework, index.php are belong to me!
I've stopped active development on Inertia primarily because developing web applications in it did not feel very PHPish. It felt as if the web application was subservient to the framework instead of it being the other way round.
Inertia was an experiment in how a Resource-Oriented Programming (ROP) Platform would look like and it was an awesome learning experience, but its time to move on.
Inertia was an experiment in how a Resource-Oriented Programming (ROP) Platform would look like and it was an awesome learning experience, but its time to move on.
Sunday, July 05, 2009
Describing Writting your web application using Bombay (take 2)
Scratch that! Screw describing the web application. Just decide for me and tell me what I need to do.
Trade-off flexibility for minimal cognitive strain and busy work.
Update July 27, 2009: Renamed Swx to Bombay
index.php
<?php
require '/path/to/bombay.php';
requires ('mojo');
function _home()
{
echo "Hello World";
}
?>
Trade-off flexibility for minimal cognitive strain and busy work.
Update July 27, 2009: Renamed Swx to Bombay
Friday, June 26, 2009
Describing your web application using Swx (take 1)
Update July 05, 2009: Dropped the idea of describing web applications in favour of minimizing cognitive strain and busy work.
Update June 28, 2009: Added the 4th pattern with default params.
Update June 28, 2009: Added the 4th pattern with default params.
index.php
<?php
require '/path/to/swx.php';
requires ('handlers');
responds_to_requests_like
(
'POST /{handler}',
'/{handler}/[{id}]',
'GET {handler}.example.com:8080 /foobar',
'/.* handler=default,id=1'
);
?>
Sunday, April 12, 2009
Being explicit about "unsafe" function
Update: I've dropped most of the ideas mentioned here.
I'm toying with the idea of prefixing unsafe functions in swx with unsafe_ (example: unsafe_swx_mapper_match). I like how this makes explicit the fact that I'm testing unsafe functions (example: test_unsafe_swx_mapper_match). This is similar to the use of the exclamation (!) suffix in Scheme and Ruby. If this works well, I might do the same in inertia.
Couple of other things you might notice if you haven't done much programming in PHP are the swx in the function names that acts like a namespace for swx and the underscore (_) prefix in some function names (example: _unsafe_swx_mapper_pattern) that marks them as private functions for internal use only.
I'm toying with the idea of prefixing unsafe functions in swx with unsafe_ (example: unsafe_swx_mapper_match). I like how this makes explicit the fact that I'm testing unsafe functions (example: test_unsafe_swx_mapper_match). This is similar to the use of the exclamation (!) suffix in Scheme and Ruby. If this works well, I might do the same in inertia.
Couple of other things you might notice if you haven't done much programming in PHP are the swx in the function names that acts like a namespace for swx and the underscore (_) prefix in some function names (example: _unsafe_swx_mapper_pattern) that marks them as private functions for internal use only.
Subscribe to:
Posts (Atom)