Recess -- New Framework

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Recess -- New Framework

Post by volomike »

This was listed on Reddit pretty highly. It's fascinating...

http://www.recessframework.org/page/rou ... screencast

I guess my criticism of it is that it appears it takes index.php and via .htaccess makes it do all the routing work. But then you have to wonder what happens to the rest of the files -- it appears they would get stuck in one single directory.

That's a problem I have with not using a framework, or with using some kinds of frameworks. If you do a massive project, you end up with too many files in one directory and it becomes confusing. It would be nice to put files in folders based on major features of the site, and then one level of subfolders under there. You name the folders to what makes sense for you to understand them, keeping them as short as possible. But then you use .htaccess to override that and rewrite whatever URL into whatever folder, subfolder, or PHP page you want to override so as to have a shorter URL.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Recess -- New Framework

Post by matthijs »

Interesting screencast. Having the routes defined next to the methods in the controllers has some advantages, not having to change things in two different places for example. However, I can also see how that's a drawback, because then you have all the possible routes of your website/app scattered all over the place. A single routing config is a bit more clear in that sense.

I do find the routing stuff interesting, as I think having good routes in place is very important. I hate it when a system doesn't allow you fine-grained control over your URLs.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Recess -- New Framework

Post by Christopher »

I am not sure if it actually does anything that other frameworks already do. The RESTful idea has been popular with a small minority for what seems like forever. My hype-meter twitched. I think Konstrukt does a really nice job at that style, but I don't think there was ever much interest. I am not sure what I think about parsing comments for information. No code released, so who knows at this point.

Matthijs - we should always be on the lookout for new and interesting routing styles that we can support. ;)
(#10850)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Recess -- New Framework

Post by John Cartwright »

Smarty templating powers views.
Enough to make me ignore it. I really do hate it when the framework makes these kind of decisions for you.
KrisJordan
Forum Newbie
Posts: 4
Joined: Wed Dec 17, 2008 11:16 pm

Re: Recess -- New Framework

Post by KrisJordan »

Hi guys - I saw that the video had been linked to from this forum and wanted to check it out. I am the creator of Recess and just wanted to address some of your concerns.

@volomike - You're right about requests being rewritten in .htaccess to pass through a 'bootstrap' dispatcher. The directory structure, though, is not as constraining as you might suspect. There is some enforced structure in that your controllers need to be in a directory of their own. Future versions may allow nested controller directories. Currently I would suggest breaking big projects down into multiple Recess "Application"s. Apps have their own folders for controllers and views. So if you were doing a project which had a front-end and back-end you might have one application for the front-end, one for the back-end, and they would share models.

@matthijs - If you skip forward to minute 8 or so you'll see how Recess addresses this. Recess will come with a 'tools' application that, among other things, allows you to list all of your route paths in a single place as well as to which controller and method it routes to.

@arborint - REST is still in the early stages of snowballing. As it becomes necessary for web applications to increasingly offer web APIs REST seems to be the most straightforward path. Sorry to have set off your hype meter :) If I sound overly excited it's because I've been working on this for about three months full time and I'm itching to get it in your hands.

@Jcart - Thanks for calling that sentence out - I should have been more careful with the description. Smarty is optional and turned off by default. Simple, native PHP files are the standard. For some people Smarty is the preferred means for rendering views. If there is another templating system you prefer it's straightforward to implement your own view class and hand the control off to it.

Appreciate your concerns and hope you'll give it a shot when the bits are public. If you're interested in trying out the preview release shoot me an email krisjordan at googly mail or sign up at RecessFramework.org

Thanks!
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Recess -- New Framework

Post by alex.barylski »

That was the most professional reply I have ever heard on a message forum...WOW...

KrisJordan: Although I wasn't really interested in your framework initially...based on your professionalism alone in reply to the above...I will check out your framework one more time.

I'm curious though, is this just for RESTful services? I mean, how does the front/router/whetever you call it...know which controller to invoke based on a URI if the mapping between controller and URI is not:

1. based on convention
2. Uses a centralized lookup map

Cheers,
Alex
KrisJordan
Forum Newbie
Posts: 4
Joined: Wed Dec 17, 2008 11:16 pm

Re: Recess -- New Framework

Post by KrisJordan »

Alex: It is not just for RESTful services, it simply makes RESTful services more natural to implement. By this I mean the primary purpose of the framework is to simplify web app development. The underlying "machinery" of the framework is structured such that handling REST APIs 'comes with the package' and doesn't require additional work from the developer.

Re: How does the framework dispatch to the correct controller without conventions or a centralized lookup?

Great question. The simple answer is that the framework asks every controller in your application for its "routes". The framework then builds up a data structure, currently a tree, that holds all of the routing information for your application. As you may suspect this is a relatively slow and expensive operation. In development mode, when your application's routes may change, Recess takes the hit and computes the tree every time. In deployment mode Recess serializes and caches this tree and refers to the cached data structure for requests N+1.

Once Recess has the routing tree it takes your request URI and steps through every part (where a "part" is self-defined as the/things/delimited/by/slashes) and matches it against the tree. This is roughly an O(log n) operation so it's really fast in deployment mode.

Best, Kris
KrisJordan
Forum Newbie
Posts: 4
Joined: Wed Dec 17, 2008 11:16 pm

Re: Recess -- New Framework

Post by KrisJordan »

Also Alex - fyi - I see you've got your own flavor of a wrapper for PDO. Recess will ship with a simple, PDO-based ORM but it does not embed it's ORM with the framework in the way Cake does. This way it is easy to use whatever library you prefer to talk to the database.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Recess -- New Framework

Post by josh »

What features does your ORM have / where can I read about it? Is it really just a data source library, or a 'real' ORM? What kinda ORM? Active Record, gateways? et.c..
KrisJordan
Forum Newbie
Posts: 4
Joined: Wed Dec 17, 2008 11:16 pm

Re: Recess -- New Framework

Post by KrisJordan »

Just posted an overview of Models in Recess.

Also, more information on controllers in Recess, the REST PHP framework, can be found here.

Finally the preview release is available at the Preview Release Program and I would love for anyone interested in trying out Recess early to register and take it for a spin!
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: Recess -- New Framework

Post by matthijs »

Kris, why do we have to register to see the code? I'd like to look at the framework, but my list of usernames/passwords already is way too long, spanning a couple of pages. Do you have an (open) repository some where?

And under what conditions are you going to "release" the code?
Post Reply