The Artima Developer Community
Sponsored Link

Weblogs Forum
Python Directions and the Web Framework Problem

17 replies on 2 pages. Most recent reply: Mar 22, 2006 4:11 PM by Ivan Lazarte

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 17 replies on 2 pages [ « | 1 2 ]
Bruce Eckel

Posts: 875
Nickname: beckel
Registered: Jun, 2003

Re: Python Directions and the Web Framework Problem Posted: Mar 7, 2006 1:22 PM
Reply to this message Reply
Advertisement
> Plus tables are just comfy. People have been dealing with
> relational data in tables for many decades now. There are
> many well known tools and techniques for doing so and they
> tend to work reasonably well across products and across
> platforms. If your object representation doesn't match the
> activity I want to perform on the data I've got to change
> it anyway. I'll have to figure out what your object model
> is and figure out how I can shoe horn that into my
> application.

Apart from relational data, the idea of a rows-and-columns grid is imprinted on us pretty early in our education. That's why spreadsheets made so much sense and became the first killer app on PCs. And a lot of simple web apps can get away with a single table.

The issue may be one of graduating complexity: the simplest approach is to just annotate fields for automated creation and CRUD of a single table. Next is some hook that allows relations between tables (perhaps using SQL, perhaps using some kind of python syntax). And in some cases, an OODB might be the solution. In this last case, I wonder if it's common enough to try to hook directly into Python, or if it should be relegated to libraries. I'm thinking the latter because it seems to indeed be a special case.

Harry Fuecks

Posts: 875
Nickname: hfuecks
Registered: Sep, 2004

Re: Python Directions and the Web Framework Problem Posted: Mar 8, 2006 4:52 AM
Reply to this message Reply
You know somehow the ORM-thing vs. "good old SQL" is something like the whole SOAP vs. REST thing which is succintly summarized here: http://pluralsight.com/blogs/dbox/archive/2006/02/17/18869.aspx

Seems to boil down to "show me your APIs" (ORM, SOAP) vs. "show me your data structures" (SQL, REST).

Every time I've tried using some kind of ORM, always end up wishing I hadn't somewhere around here;


customer.addJoin('LEFT JOIN customer ON cust_order_link.cust_id = customer.id');


Why not accept that SQL is actually a pretty good mini language (ignoring vendor differences) and using a typical imperative programming language makes a horrible tool for working with sets - Venn diagrams can be expressed nicely with SQL.

Given that perspective, any kind of DB api becomes more about getting the data structures you need (i.e. relevant to the environment you are writing apps for) with the least possible effort.

One API I've seen that does this for web applications is here: http://cvs.sourceforge.net/viewcvs.py/wact/wact/framework/db/db.inc.php?view=auto

In Python terms it might be something like;

print "<select>"
 
for option in db.getOptionMap('SELECT id, name FROM users'):
    print "<option value=\"%(id)\">%(name)</option>" \
        % {'id':option[id],'name':option[name]}
 
print "</select>"

Ivan Lazarte

Posts: 91
Nickname: ilazarte
Registered: Mar, 2006

Re: Python Directions and the Web Framework Problem Posted: Mar 22, 2006 4:11 PM
Reply to this message Reply
Nail on the head.

In general I think a lot of the web frameworks completely miss the point. Give me some way to work with a database in a simple and expressive manner. Stop hiding me from it, tie me closer to it, I want it's power! At the same time, find a way to give each db installation more bandwidth and stability, or else you just make me cache everything...

Blarg!

With regard to specifically Java, I do believe there's still a lot of room for simplication though, and Stripes is a gem of a framework that's heading in that direction.

Flat View: This topic has 17 replies on 2 pages [ « | 1  2 ]
Topic: Ruby Reviews Previous Topic   Next Topic Topic: The Java Posse

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use