Promoting Python as web application development language

Jay O'Connor joconnor at cybermesa.com
Sat Aug 24 11:24:44 EDT 2002


On 23 Aug 2002 07:10:49 -0700, Paul Rubin
<phr-n2002b at NOSPAMnightsong.com> wrote:

>Max M <maxm at mxm.dk> writes:

>> > The indentation syntax is nice for normal programming but it's a
>> > pain in the neck for template programming where you're mixing
>> > Python code and HTML and you more often want to jam multiple
>> > statements on a line.
>> 
>> Hmmm that is a bad way to code. There are som systems that use it
>> though.
>
>It's an ok way to code some of the time.  You don't want to do huge
>functions that way, but we're talking about embedding 2 or 3 short
>Python statements to spew a value in a table cell or something like that.
>If you're generating your HTML in some kind of visual layout editor,
>it's hard enough dealing with template systems already.  Having to mess
>with adjusting indentation too is just more headache than you need.

It's a bad way to program.  Mixing interface and application logic is
a bad idea in general.

It seemed that around the late eighteies or early nineties people
started realizing that mixinf application code and display code was  a
bad idea and models such as "Model-View-Controller" and
"Model-View-Presenter" and others started getting really popular
(yeah, I know MVC had been around since the 70s, but it seemed like
people were really starting to take it more seriously in the early
90s).  Then the Web hit and for various reasons, a lot of good
software engineering principles seemed to be abandonded.   One of
those was the seperation of concerns between interface code, domain
code, database code.  You see this a lot in CGI scripts where the same
scipt loads data from the database, calculaes intermediat values and
prints the HTML.  Not really  agood idea for application programming;
not  really a good idea for web programming, either. Over time, as web
projects got larger, it seemed some of those principles were
redicovered, which is why we now have tools that are good at
seperating the display code (the HTML) from the business logic.  BTW-
I think this is a prblem with PHP and ASP as well.

Python's formatting (indentation) tends to discourage somethng that's
a bad idea, anyway.

>I'll look for something about those.  I'd never heard of cheeta before.
>
>> Because Python is a good and practical language it usually has several
>> solutions to the problems that a 'language' like php has only one
>> solution to.
>
>I think Python is better for writing complex application logic but PHP
>is better for putting HTML up on the screen.

One other aspect of scalablity in application size that sorta got
forgotten was that for simple programs (such as programs that just
take user queries, submit them to a db and then displays records in
some sort of able format fornavigation and editing.  In the early 90s
a lot of tools could put together theses kinds of applications in
abuot 5 minutes.   The problem was that these tools that allowed one
to do such stuff easy, tended to get in the way as the program had to
think more about the actual data.   As the problem scales up, the
ability to quickly throw together a UI becomes lee important to the
ability to build complex and powerful abstractions to describe the
problem domain and it's interactions.

This is, again, a problem with PHP and ASP for building web sites of
significance.  I think it's also a problem with Perl.  Perl works
great as a tool when you have to convert or manipulate output from one
program (such as a database) into an input format for another language
(such as a web server/browser).  However, as theproblem itself grows
larger and more complicated; as the program has to think more about
the meaning of the data and it's relationships; Perls abilities and
support for complex abstractions falls short in comparison to Python.

Python may not be as good as PHP or even Perl at putting HTML on the
browser, but as your applications scale in size, that becomes less
important in relation to the ability to solve complex problems and
build powerful abstractions, which is something Python excels at.  

Take care,
Jay
Jay O'Connor
joconnor at cybermesa.com
http://www.cybermesa.com/~joconnor


"God himself plays on the bass strings first, when he tunes the soul"



More information about the Python-list mailing list