07
Aug 07

A Future Web Development Framework – Architecture

Path: mv.asterisco.pt!mvalente
From: mvale…@ruido-visual.pt (Mario Valente)
Newsgroups: mv
Subject: A Future Web Development Framework – Architecture
Date: Mon, 06 Aug 07 23:47:21 GMT

If you have now digested the contents of my previous post
on this subject, I’ll proceed with my thoughts on architecture
for a future web framework.

http://mv.asterisco.pt/cat.cgi?A%20Future%20Web%20Development%20Framework%20-%20Introduction

(yes, I know I said “must be done this weekend”; I meant
“this week”…”month”…”before the end of the year” :-)

I guess that there isnt much to say about the need for the
use of two patterns: the 3-tier system architecture and the
MVC design pattern. These two patterns are by now commonly
understood and used and their need is accepted by anyone doing
web applications.

The problem is that these patterns are in and of themselves
in conflict. And although they are understood and used, because
of that inbred conflict a few problems arise in several (if not
all) web development frameworks.

The 3-tier architecture is a system design pattern. It splits
the components of an information system into 3 levels, namely
Data, Logic and Presentation.

        +--------------------+
        |                    |
        |                    |
        |   Presentation     |
        |                    |
        |                    |
        +--------------------+
                 ^
                 v
        +--------------------+
        |                    |
        |                    |
        |      Logic         |
        |                    |
        |                    |
        +--------------------+
                 ^
                 v
        +--------------------+
        |                    |
        |                    |
        |       Data         |
        |                    |
        |                    |
        +--------------------+

Notice the two way communication between each tier.

This is normally used to split an information system into
technological components that can be scaled either vertically
(ie. buy bigger iron) or horizontally (ie. buy more machines)

The above diagram is usually made real with the database server
representing the lower Data level, the application server (and
application code) representing the middle Logic level and the
webpages/templates/HTML/CSS representing the presentation level.
The webpages deal with UI which, when needed, calls functions
at the appserver to do some processing; these functions use
data and store data in the database, process the data and return
the results to the (possibly another) webpage.

We now have one of the problems with this pattern that is
reflected time and again in several web frameworks: the presentation
level is actually 2 levels in one. At presentation level not only
do you have the actual look/UI of the app, you also have some code
(ie. logic); but its a different type of code/logic from the one
that is resident at the middle Logic level. The middle Logic level
is constituted only by business logic. The logic/code present at
the presentation level should only be code for application behaviour
and orchestration.

Several webframeworks, when confronted with this, allow for
a complete powerful language within the templating system. This
powerful language immediately gets used to do more than UI stuff
and programmers start using it to do business logic. Chaos ensues.
Presentation stuff (HTML) is mixed with code (ASP, PHP, whatever),
you lose the important separation between Model and View (MVC pattern)
and you get designers and programmers stepping on each others toes
when files get passed between the HTML editor of choice (which usually
mangles the code) and the programmers editor of choice.

(Dont talk to me about achieving that through discipline; that
means that either you have never worked in a real project or
that you’ve never experienced launch date crunch; which means
that you’ve never worked in a real project…)

The MVC pattern is a design pattern. You use it to model
an information system that includes a user interface (UI).
The system is decoupled into a Controller (UI component),
a View (UI component) and a Model (domain abstraction)

           +----------------+             +----------------+
           |                |             |                |
           |                |             |                |
           |   Controller   |   (MVC model component)
                        v          |
                +---------------+  |
                |               |
                |     Data      |
                |               |
                +---------------+

The 3-tier pattern is actually a 2+2 tier (and might
actually be 2+3 tier if you consider that at presentation
level you have a subset of the data level)

To achieve a coherent use of both patterns, a web
framework must ensure that its templating system does
not allow for programmers to use it for business logic.
There are several ways that this can be done: by making
sure that UI is done declaretively, that the language is
limited in its power (HTML only) and by making sure that
all subset data in the view is produced only by the business
logic (through a controller call to the logic level) and not
by direct manipulation of the view by the controller.

From the previous diagram it is clear what my next
posts subjects will be:

– Backend Storage
– Application Logic
– Templating (view stuff)
– Form Handling (controller stuff)

This is only looking at the boxes. If you look closely
at the diagram there are also arrows. These represent other
stuff that must be addressed:

– URL mapping (the arrow between controller and logic)
– data access/exchange (the arrows be logic-view and logic-data)

— MV


28
Jul 07

A Future Web Development Framework – Introduction

Path: mv.asterisco.pt!mvalente
From: mvale…@ruido-visual.pt (Mario Valente)
Newsgroups: mv
Subject: A Future Web Development Framework – Introduction
Date: Sat, 28 Jul 07 01:30:21 GMT

I have decided that my promised reflections on web
development frameworks must be done this weekend.
I have also decided that it’s not going to be one
long post; and so, more to kick myself into starting
than anything else, here’s the first part: its actually
a braindump of links to read and understand the rest of
my commentaries.

This first post should be regarded as a prerequisite
reading list…

Please Teach me Web Frameworks for Python
http://www.artima.com/weblogs/viewpost.jsp?thread=146149

WebFS: a Web of Data
http://www.zefhemel.com/archives/2007/03/04/webfs

Python web development and frameworks in 2007
http://jesusphreak.infogami.com/blog/vrp1

Web Framework Manifesto
http://blog.circleshare.com/?/archives/16-Web-Framework-Manifesto.html

The Right Way to do Ajax is Declaratively
http://duncan-cragg.org/blog/post/right-way-to-do-ajax-is-declaratively/

Enforcing Strict Model-View Separation in Template Engines
http://davidrupp.blogspot.com/2007/06/required-reading-enforcing-strict-model.html

Aren’t the MVC and 3-Tier architectures the same thing?
http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq26

From all of the above it follows that my next posts subject’s will
be:

– Architecture
– Backend Storage
– Application Logic
– Templating
– Form Handling
– URL Mapping
– Existing Frameworks

— MV


19
May 07

The Future of Web Development

Path: mv.asterisco.pt!mvalente
From: mvale…@ruido-visual.pt (Mario Valente)
Newsgroups: mv
Subject: The Future of Web Development
Date: Sat, 17 May 07 20:08:21 GMT

Ever since I chose Zope (back in 1999) as the basis for
easy web development, I’ve been constantly looking for better
alternatives. One such alternative, back in 2005, was (for
me) the choice of Nuxeo CPS (which is Zope based).

http://www.zope.org/
http://www.cps-project.org/

That constant search was definitely not helped by the
development of Zope 3; technically its brilliant; its a
total mess in pragmatic terms. Even I, with a brain the
size of the universe, am unable to totally grasp its
concepts. Which it figures: being the concept child of
Jim Fulton, a genius, trying to actually grasp it means
your brain could explode.

The search was also completely botched by Nuxeo’s option
to switch from Python development to Java development. I
guess stupidity is a God given right, so I won’t say much
about that choice.

Meanwhile, lots of stuff has come up: Django, Pylons,
TurboGears, Ruby on Rails, you name it… I dont want to
go over extensively why I dont like any of them, but let
me just state this: if the “framework” allows for the
mixing of layout/design/HTML with code/programming, for
me is enough of a disqualifier.

A mix of CherryPy with PyMeld is the closest thing that
I have found that aproximates what I have in mind, but
still not enough, which is why I’ve been thinking about
developing a “framework” of my own (dont we all…)

http://www.cherrypy.org/
http://entrian.com/PyMeld/

The Wheat project also seems to have some good ideas
but unfortunately it seems to have stopped:

http://www.wheatfarm.org/

My justification for the current lack of better choices
is that there’s a complete lack of understanding on the
relation between the 3-tier architectural pattern and the
MVC architectural pattern. If you think they are one and
the same thing, you dont know jackshit; if you know they
arent the same thing but fail to understand the relation
between those two, expect a post from me on the subject
one of these days. Meanwhile, go and read this:

http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq26

Still, while on the lookout, I’ve always kept an eye out
for the ActiveGrid guys ( http://www.activegrid.com/ ). If
there’s someone who’s thinking long term and in terms of
future standards use (BPEL, XPath, XForms, etc), its them.

Their latest screencast is a feast for the eyes and mind
and puts to shame some of the “ooh-aah” demos that have
been floating around for the last 3 or 4 years. Go watch
it and cry:

http://www.activegrid.com/demo_screencast/empnom2/empnom2.html

— MV