views:

7

answers:

2

My mate and I are designing/implementing a web based media application. It will provide media management and distribution abilities.

Long story short, as much as we want a web based GUI for users to be able to perform site functionality (CRUD) and also have an administration area to control various aspects of users there is another constraint on this project.

Namely, we want a way to invoke site functionality via CLI or potentially down the road other ways. In this regard I see that we need some "dispatcher" that will accept different entrances to the code and execute the libraries.

Additionally, we are looking into using ajax push type strategies (possibly ape-project) for the site but we want to code our server side libraries in such a way that we can invoke actions via a click on the web (through jquery for example) and also be able to do % mediaSite -refreshlibrary or something of that sort?

Are there design ideas like this available or projects with this type of idea implemented that I could review, use or design in similar fashion?

Any comments/questions Im happy to discuss. And if you need more information ask away, I can add more as we have already formulated a lot of the design.

A: 

In an MVC pattern (Model–View–Controller), it would be as simple as making the controller aware of input type & output type (either in the same controller, or by invoking a different controller extending a base one), which possibly translate arguments incoming (form/url-encoded, get, json, xml, cli) into the 'real' argument structures, possibly invoking different views based on expected return (a json request from javascript could have a json return and / or an html return for instance, a cli request mostly plaintext, etc.). As long as the functionality of your Models isn't bound to web/http presentation, it could be fairly simple.

In more 'data-driven' projects I've had very little trouble using the exact same actions as soap-methods, javascript returns, and 'default' html / browserrequests.

Wrikken
thanks for some reason this just didnt seem to make sense to me
Chris
A: 

I would look into the Model-View-Controller pattern. MVC is used in many frameworks, but I think you should look into purer forms of the pattern. What you want, it sounds like, is to use different Views with the same Model and Controller code. In your case, your different Views will not all be web-based - you'll have a web view, a command line view, a QT app view, etc.

Scott Saunders