Seaside: Composing Components
Damien Cassou, Stéphane Ducasse and Luc Fabresse
http://stephane.ducasse.free.fr
Remember: Seaside
- Think in terms of reusable and stateful components
- A web application = a root component
- Live Debugging
- through the debugger, you can modify objects and proceed to generate the HTML response
Roadmap
3 mechanisms to reuse components:
- Components aggregation
- The
call:
/ answer:
mechanism
- Definition of workflows (Task)
Roadmap
3 mechanisms to reuse components:
- Components aggregation
- The
call:
/ answer:
mechanism
- Definition of workflows (Task)
Remember: Counter / TwitterCounter
WACounter
WATwitterCounter
How to Build a Multi-Counter Application?
WAMultiCounter
WAMultiCounter
How to Compose Components?
A composite:
- Stores subcomponents in an instance variable (e.g.
counters
)
- Sends
render:
to subcomponents in its renderContentOn:
method
- Redefines
children
to return the collection of its subcomponents
Aggregating Different Subcomponents
Aggregating Different Subcomponents
Rendering Only One Subcomponent
Rendering Only One Subcomponent
Roadmap
3 mechanisms to reuse components:
- Components aggregation
- The
call:
/ answer:
mechanism
- Definition of workflows (Task)
call:
call:
answer:
answer:
call:/answer: Example
WAInputDialog Internals
WAInputDialog
- is a reusable component
- it
answer:
a result
Roadmap
3 mechanisms to reuse components:
- Components aggregation
- The
call:
/ answer:
mechanism
- Definition of workflows (Task)
Encapsulating Workflows
Tasks are simple components:
- No UI part (i.e. no
renderContentOn:
)
- Orchestrating several components
- use
call:
/answer:
behind the scene
A Simple Web Task
How request: is Implemented?
request:
uses call:
/ answer:
on a WAInputDialog
How inform: is Implemented?
inform:
uses call:
/ answer:
on a WAFormDialog
Stepping Back
- No manual request parsing
- No request routing
- No hardcoding of next page
- No XML configuration files
Conclusion
Seaside provides:
- Stateful components
- Components composition (children)
- Components scheduling using
call:
/ answer:
- Tasks to encapsulate workflows
/