This is a quick note of some things I've been thinking
with regards patterns for web app development. It's
divided into four sections:
1. My understanding of Struts-MVC
2. Content Object Models
3. Patterns
4. Questions
MY UNDERSTANDING OF STRUTS-MVC
------------------------------
Just a quick review of MVC for struts, illustrating
the basic request scenario (in collaboration diagram
format):
Control Model
HTTP(1) +--------+ +--------------+
-------->| Action |------>| Object Model |
Request +--------+ +--------------+
|(2) ^
V |
HTTP (3) +--------+ |
<--------| JSP |-------------+
Resposne +--------+
View
1. Request comes in, goes through controller (ActionServlet)
and is handled by an Action.
2. Action performs (optional) business logic, and either
creates response itself, or forwards request to JSP
(or servlet) to create the response.
3. JSP (servlet) generates response, and sends it back to
the client.
CONTENT OBJECT MODELS
---------------------
What I'm seeing is that the Action is responsible for creating
some "data" that is used later in generation of the resposne.
Oleg does this with BeanFactory (if I understand it correctly).
These are the types of "data" (let's call the Object Models or
simply OM) I see:
1. JavaBeans Heirarchical, Java
2. DOM Heirarchical, platform independent
3. JDBC Flat, Java, (RowSet)
Accessing these object models from a (struts-enabled) JSP
requires the use of notation below:
object model notation navigating object models
------------ -------- -------------------------
JavaBeans "dotted" user.address[0].city
JavaBeansX "extended-dotted" user.address{billing}.city
JDBC "dotted"? ?
DOM XPath user/address/city
JDBC (RowSet) and DOM are planned for 1.1:
http://jakarta.apache.org/struts/todo-1.1.html
In my thinking, I've been calling the "object models"
Content Object Models since the OMs really represent the
"content" (which we wanted to separate from logic as well as
from presentation).
PATTERNS
--------
The pattern I'm seeing for developing web applications is this:
1. Action generates Content Object Model (COM).
2. COM is transformed to presentation
In various frameworks, we see how this is done:
Framework OM Factories Presentation
--------- -- -------- ------------
Struts JavaBeans Action JSP/other
Cocoon2 DOM Generator XSLT
With this pattern, I can envision this pattern for a whole
web application:
Control
+--------+
| Action |-----------+
+--------+ |
V
+--------+ +--------+ +------------------+
| Object |<--| client |---->| Business Logic |
| Model | +--------+ | (possibly part |
+--------+ | of some component|
^ + framework, EJB) |
View | +------------------+
+-------------+
|JSP/Servlets |
+-------------+
\_______________/ \________/ \_______________________/
Web-based UI "Glue" code UI-less application
The utility of a "UI-less" app means you can deveop
applications on top of it, such as:
- Rich application
- Web-app
- command-line app
In our case, we're concerned with a web-apps, where:
- Client: presents a Facade (GOF pattern) into the
Business Logic
- Web-app only knows about the application through the
Client
- Client generates Content Object Models (COM)
- JSP/Servlets generate presentation based on COM
My guess is that large scale applications would require
some sort of abstraction along the lines presented above,
while smaller applications will tend to not use the "client"
and "object model" abstractions (and hence the model pattern
above collapses to just 3 parts: Control, View, Model
[business logic]).
QUESTIONS
---------
Having said all that, my questions are:
1. Are there other frameworks that fit into this Content Object Model
(COM) Pattern?
2. Is this COM Pattern a pattern that struts-users are using, and if
so, is it working for you?
3. If these ideas are not new or there are similar ideas, can someone
send me references to them?
Thanks,
Gidado