[Components] MVC: Final draft of requirements document

2008-02-07 Thread James Pic
Hello everybody !

We are done with a final draft, document attached.
I'll post an implementation document first draft tomorrow morning.

I also want to thank two very special and talented persons whom 
have higly contributed : Kore Nordmann and Tobias Schlitt.
This document would have never met such a high-quality (to my opinion)
without the experience and time that you have shared !

Cheers, James.

-- 
James Pic
eZ Component: MvcTools, Requirements

:Author: James Pic, Tobias Schlitt
:Revision: $Revision$
:Date: $Date$

Target and scope


The scope of this document is to describe the requirements for a component
providing classes to implement a MVC_ architecture for a web application. This
document does not describe the design of the named component, but only
summarizes the requirements for it as discussed on the developer mailinglist.
Where suitable, design related topics will be touched, but a dedicated design
document will follow later, defining APIs, classes and the architectural
structure of the component.

Note that if you don't understand a term, you should have a look at the section
`Clarification of terms`_.

Introduction


Model-View-Controller (MVC) is a common architecture pattern to implement all
kinds of applications using the object-oriented design paradigm. The goal of
the MvcTools component is to give users a basis for such architectures for web
applications written in PHP 5. The component shall not provide a full-featured
implementation of the MVC architecture, but should help users to easily create
their own, custom implementation.

A good starting point to learn more about MVC is the Wikipedia article:
http://en.wikipedia.org/wiki/Model-view-controller

Component integration
=

eZ Components already provide some components that are useful when
implementing an MVC. However, one basic goal of eZ Components is to keep
each component as independent as possible and to realize dependencies
through so-called tie-in components. Therefore the mechanisms realized in an 
MVC component
should be that far abstracted, that other components can be tied in and
provide only very basic implementations on its own. This also allows
users to implement their own mechanisms. The following components have been
identified as possible tie-ins:

- Template_ (view)
- UserInput_ (routing)
- Url_ (routing)
- PersistentObject_ (models)
- EventLog_ (error-handling)
- Mail_ (error-handling, view)

.. _UserInput: http://ezcomponents.org/docs/tutorials/UserInput
.. _Url: http://ezcomponents.org/docs/tutorials/Url
.. _PersistentObject: http://ezcomponents.org/docs/tutorials/PersistentObject
.. _EventLog: http://ezcomponents.org/docs/tutorials/EventLog
.. _Mail: http://ezcomponents.org/docs/tutorials/Mail

For each of these components a tie-in component could considered to be
implemented at a later stage. This should be kept in mind when desigining the
classes/interfaces for the MvcTools component.

Design requirements
===

This section summarizes the requirements regarding the later following design
document.

I/O abstraction


Modern applications often require to deal with different input and output
protocols and formats (for example HTTP-GET, HTTP-POST, SOAP for the input part
and HTML, PDF, ReST-webservices for the output part). Therefore, protocols
input and output formats should be abstracted into dedicated objects, which are
not specific to a certain protocoll or format.

Controllers will only receive these abstracted data objects without knowledge
of the used format/protocol, to allow the re-use of 1 controller with severl
different input/output sources.

A benefic side-effect relates to controller-testing: Creating input and output
mocks and fixtures allows straight-forward TDD.

Summary
^^^

- Controllers should not know about the input and output environment but work
  on abstract objects only.

Layers
--

The MvcTools component should distinguish certain layers to allow users to
easily adjust and replace certain functionality. Therefore, the following
requirements have been specified.

Controllers process and respond to events, typically user actions, and
may invoke changes on the model. In our case, controllers run an action using a
single argument: An input-object. A controller returns an output-object, after
being run.

Another different layer is responsible to select the controller to run and the
action to call on it. To create the input-object it requires the so-called
input-router. After the controller has been run, the output object is send to
the view-manager, which is responsible to select the correct rendering mode for
the output protocol/format.

Those two layers should be able to use any number of controllers per-request.
They handle the client-protocol, so that the controller doesn't have work on
raw input data (e.g. GET/POST/...) and does not have to generate any specific

Re: [Components] MVC: Final draft of requirements document

2008-02-07 Thread Thomas Nunninger
Hi,

> We are done with a final draft, document attached.

Good work! Just one small error I found (it's correct above in the 
document):

"Summary
^^^

View-manager role:

- Receives abstract input object
- Builds the concrete response and sends it to the client"

The view manager receives an output not input object...

> I'll post an implementation document first draft tomorrow morning.

Looking forward to it!

Have a nice day

Thomas
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components


Re: [Components] MVC: Final draft of requirements document

2008-02-11 Thread Derick Rethans
On Fri, 8 Feb 2008, James Pic wrote:

> We are done with a final draft, document attached.
> I'll post an implementation document first draft tomorrow morning.

Great work! I've some comments though :)

> I/O abstraction
> 
> 
> Modern applications often require to deal with different input and output
> protocols and formats (for example HTTP-GET, HTTP-POST, SOAP for the input 
> part
> and HTML, PDF, ReST-webservices for the output part). Therefore, protocols
> input and output formats should be abstracted into dedicated objects, which 
> are
> not specific to a certain protocoll or format.

[snip]
 
> A benefic side-effect relates to controller-testing: Creating input and output
> mocks and fixtures allows straight-forward TDD.
> 
> Summary
> ^^^
> 
> - Controllers should not know about the input and output environment but work
>   on abstract objects only.
> 
> Layers
> --
> 
> The MvcTools component should distinguish certain layers to allow users to
> easily adjust and replace certain functionality. Therefore, the following
> requirements have been specified.
> 
> Controllers process and respond to events, typically user actions, and
> may invoke changes on the model. In our case, controllers run an action using 
> a
> single argument: An input-object. A controller returns an output-object, after
> being run.
> 

I am just wondering about this... HTTP-GET should not be allowed to 
invoke changes on the model - it violates the HTTP standard. Therefore, 
you do need to transfer which protocol is used to the controllers.

> Error-handling
> --

[snip]

> Those errors cannot be handled by the controller, because they happen
> outside of it. A configurable default controller will be called for all
> error messages, so the application developer may decide to send
> messages, show or log the occured error. An error during the execution
> of this default controller will cause a "501 - Internal Server Error".

Make sure to follow HTTP standards here. This diagram is excellent for 
it: http://thoughtpad.net/alan-dean/http-headers-status.html

> TieIns for this default controller using the EventLog and / or Mail
> component for error logging would be useful.

Perhaps "Execution" would be beneficial as well.

Otherwise, it looks good!

regards,
Derick
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components


Re: [Components] MVC: Final draft of requirements document

2008-02-12 Thread James Pic
Hi,

Thanks a lot for your revelant feedback.
I've merged your requirements and commited the document on :
http://svn.ez.no/svn/ezcomponents/experimental/MvcTools/design/requirements.txt

Derick Rethans wrote:
> On Fri, 8 Feb 2008, James Pic wrote:
> > Error-handling
> > --
> 
> [snip]
> 
> > Those errors cannot be handled by the controller, because they happen
> > outside of it. A configurable default controller will be called for all
> > error messages, so the application developer may decide to send
> > messages, show or log the occured error. An error during the execution
> > of this default controller will cause a "501 - Internal Server Error".
> 
> Make sure to follow HTTP standards here. This diagram is excellent for 
> it: http://thoughtpad.net/alan-dean/http-headers-status.html

Indeed, 501 is for "Unsupported Content-*", 500 seems the most revelant to me.

Best regards.

-- 
James Pic
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components