On 10/23/12 18:20 , Andreas S�derlund wrote:
> I'm thinking how and when a DCI context can be used in a Web
> application. I'm considering this high-level use case:
>
> 1. User enters city, arrival, departure, room type and clicks "Search".
> 2. System displays a list of hotels
> 3. User clicks on a Hotel logo to read its details
> 4. System displays hotel details
> 5. User clicks "Book now"
> 6. System displays payment form
> 7. User enter customer details, billing information and clicks "Submit".
> 8. System validates billing information and displays a booking
> confirmation.
>
> This is very high-level and surely needs to be broken down. The first
> steps (1-2, 3-4, 5-6) feels like simple resource requests that could be
> handled with some search- and REST-architecture. So my first question
> is, is there a need for a DCI-context in those cases, isn't plain MVC
> enough? Of course a "Hotel" data entity could play a role, but would you
> consider it feasible, especially if it's the only actor?
The way I've done it in webapps, the logic is implemented by a REST API
that only uses DCI for its implementation. Each /foo/ becomes a context,
and within that context is a number of queries and commands (e.g.
/foo/search and /foo/book, note the lack of / here which indicates that
it is not a usecase but an interaction), which can lead to subcontexts
/foo/bar/, having its own queries and commands. From the root / you
would then get hypermedia showing all usecases, and then from each /foo
you get hypermedia with links to what you can do within that usecase,
and that can then be used to drive the application state, just as Roy
intended it. It is teh awesome, and suddenly this whole linking thing
becomes obvious. A good REST API should be like an ugly website, is my
rule of thumb.
One the client side you can then either have a webapp that uses MVC, or
a rich client in Javascript or whatever that uses this. I've done both,
and the unified REST backend really helps.
/Rickard