On Fri, Jan 28, 2005 at 12:43:35PM +0100, Andr? van Toly wrote:
> At 11:30 +0000 28-01-2005, Kees Jongenburger wrote:
[ ... ]
> >I dislike MVC because it's anty OO and you have to do everything
> >3 or more times.
This is more of a problem with certain MVC frameworks than others.
Struts makes you type a lot of code and xml files before you can do
anything useful, but with perl's Maypole or ruby's Rails framework
you can more or less specify everything in concise code (as an extreme
example, Maypole can even create a generic CRUD application (something like
the mmeditors) directly from the database schema, no editing of XML
files, just a few lines of initialisation code to set up the relations
between the tables) which is then easily extended and modified to your
needs. Rails can do something similar, but I haven't had the time to
experiment with it so I don't know how fast that can be done.
> And, in my view, MVC presumes that you can
> completely define your site's model beforehand.
> Which is maybe the case in some high profile web
> sites, but in most cases is not. It's not very
> iterative.
How's that different from creating the builders and relations first
before writing the jsp pages to display/edit them? If you need to change
your model (move data from one table to the next, use
different relations etc) that really is much easier to do when you have
all the code that interacts with the data in one place (i.e. in the
model classes) instead of having to grep through hundreds of jsp pages
that query the cloud via getlists... And for simple modifications like
adding tables, relations or properties I doubt that you need to do much
more in a good MVC framework than you need to do right now.
> One of the concepts, i believe, that laid the
> fundament for the web was the iterative nature of
> HTML. You could (can) at every moment change the
> look of your page by fiddling with your
> HTML-tags. And that's also the nature of the
> current MMBase taglib, you can fiddle as much as
> you like until it looks right ;-)
MVC is not about the look - It's talking about how the data on
the page is retrieved from the database and how you get user input back
in the database. You can still use jsp's and taglibs to query the model
classes and display some nice html. In fact, that is basically what
MMBase is doing already, it just doesn't really have a controller
(usually everything, including the cloud connector, is set up via the
taglibs) and for the model you use the bridge (cloud, nodemanagers, nodes
etc) which is nice if you basically want to program against the database
directly, but can become quite irritating if you want:
* guarantees about input data for the whole application (currently, I
think you need to override setValue or preCommit in MMObjectBuilder,
while I would like to just extend a bridge node - at least then you can
really add methods to your objects).
* have "logical units" of data that are spread over multiple builders,
like (sort of contrived example):
Page -[ PosRel(s) ]- Paragraph(s).
Ideally, I'd like to be able to do something like this:
<h1>${page.title}</h1>
<c:foreach var="paragraph" items="${page.paragraphs}">
<h2>${paragraph.number}. ${paragraph.title}</h2>
<p>${paragraph.body}</p>
</c:foreach>
What I _don't_ like is having to change any of this code when I decide
to store the paragraph's numbers from the paragraph table to the
posrel.pos field or vice-versa, because that is the responsibility of
the model, not of some jsp page that happens to display a page.
I wrote an article about MVC frameworks (from a perl perspecive)
which tries to explain what's so great about MVC:
http://perlmonks.org/index.pl/?node_id=402070
> I think MMBase could use both kind of logics,
> buth a taglib that is more suitable for
> 'iteratively' building smaller sites will be my
> favorite.
Certainly taglibs can be useful, but having a good model in the first
place can dramatically reduce the amount of (taglib) code that is actually
needed to display something useful. What I'm trying to say is that the
builder stuff makes it too hard to abstract things away. The current
taglibs (the ones in mmbase 1.7) are probably the best you can do with
the current model - hence the talk about wrapping bridge Nodes in
something that can more easily interact with jstl.
Just my 0.02 euros, anyway.
Joost.
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers