Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Web development with Python 3.1 (http://www.velocityreviews.com/forums/t703108-re-web-development-with-python-3-1-a.html)

Dotan Cohen 10-27-2009 02:17 PM

Re: Web development with Python 3.1
 
Why the push to use a framework, and why the resistance from the OP?

Does the OP need to work with cookies or other http-specific features?
In fact, other than cookies, what http-specific features exist? Does
Python have a built-in framework for making available GET and POST
variables? Database queries should be no different than in other
Python apps.


--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

Diez B. Roggisch 10-27-2009 02:26 PM

Re: Web development with Python 3.1
 
Dotan Cohen wrote:

> Why the push to use a framework, and why the resistance from the OP?
>
> Does the OP need to work with cookies or other http-specific features?
> In fact, other than cookies, what http-specific features exist?


declarative mapping of urls to code, of code to templates, abstracting away
the details of GET and POST, validating and decoding parameters, especially
if these become larger repetitive structures like several addresses of a
user, re-rendering invalid form-data, working with HTML or JSON as output,
managing transactions, providing a error-reporting-infrastructure

The list continues.


> Does
> Python have a built-in framework for making available GET and POST
> variables? Database queries should be no different than in other
> Python apps.


Yes, in the end of the day, it's all python.

Diez

Dotan Cohen 10-27-2009 06:36 PM

Re: Web development with Python 3.1
 
> declarative mapping of urls to code

Apache does this, unless I am misunderstanding you.


> of code to templates


Those who code in HTML don't need this. In any case it's not hard to
call a function in a class that writes the HTML before the content,
then write the content, then call another function that writes the
HTML after the content. This is how my sites are run, though in PHP
instead of Python. No prepackaged templates.

> abstracting away
> the details of GET and POST


GET is easy, just parse the HTTP request. I don't know how much of a
problem POST would be.


> validating and decoding parameters, especially
> if these become larger repetitive structures like several addresses of a
> user


This falls under database, cookies, or HTTP request parsing. Or am I
misunderstanding something again?


> re-rendering invalid form-data


Just add it into the HTML.


> working with HTML or JSON as output,


Same as writing to stdout, just output the HTTP headers first.


> managing transactions, providing a error-reporting-infrastructure
>


This does not differ from regular (non-web) Python coding.


> The list continues.
>


I would really like to know what else. So far, I am not convinced that
a framework offers anything that is not already easily accomplished in
Python.

--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

geremy condra 10-27-2009 06:58 PM

Re: Web development with Python 3.1
 
On Tue, Oct 27, 2009 at 2:36 PM, Dotan Cohen <dotancohen@gmail.com> wrote:
>> declarative mapping of urls to code

>
> Apache does this, unless I am misunderstanding you.
>
>
>> of code to templates

>
> Those who code in HTML don't need this. In any case it's not hard to
> call a function in a class that writes the HTML before the content,
> then write the content, then call another function that writes the
> HTML after the content. This is how my sites are run, though in PHP
> instead of Python. No prepackaged templates.
>
>> abstracting away
>> the details of GET and POST

>
> GET is easy, just parse the HTTP request. I don't know how much of a
> problem POST would be.
>
>
>> validating and decoding parameters, especially
>> if these become larger repetitive structures like several addresses of a
>> user

>
> This falls under database, cookies, or HTTP request parsing. Or am I
> misunderstanding something again?
>
>
>> re-rendering invalid form-data

>
> Just add it into the HTML.
>
>
>> working with HTML or JSON as output,

>
> Same as writing to stdout, just output the HTTP headers first.
>
>
>> managing transactions, providing a error-reporting-infrastructure
>>

>
> This does not differ from regular (non-web) Python coding.
>
>
>> The list continues.
>>

>
> I would really like to know what else. So far, I am not convinced that
> a framework offers anything that is not already easily accomplished in
> Python.


Using a framework helps to ensure that your code is easy to maintain.
DRY isn't about saving time now, its about saving time six months
from now.

Geremy Condra

Dotan Cohen 10-27-2009 07:11 PM

Re: Web development with Python 3.1
 
> Using a framework helps to ensure that your code is easy to maintain.

I see, that is a good point. With someone else (the framework
maintainers) worrying about maintaining function such as HTTP request
parsers, a lot of work won't have to be [re]done.


> DRY isn't about saving time now, its about saving time six months
> from now.
>


I suppose in this case it's DRTW (don't reinvent the wheel) but the
same principle applies.


--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

Aaron Watters 10-27-2009 07:27 PM

Re: Web development with Python 3.1
 
On Oct 27, 10:26*am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
....
> Yes, in the end of the day, it's all python.


For me, in the end of the day, it's all java or PHP.
But I'm working on that. For my purposes the "frameworks"
don't really help much. That's why I built WHIFF :).

http://aaron.oirt.rutgers.edu/myapp/..._2200.TreeView

-- Aaron Watters

===
If all you got is lemons, make lemonade.
-- anon.

geremy condra 10-27-2009 07:45 PM

Re: Web development with Python 3.1
 
On Tue, Oct 27, 2009 at 3:11 PM, Dotan Cohen <dotancohen@gmail.com> wrote:
>> Using a framework helps to ensure that your code is easy to maintain.

>
> I see, that is a good point. With someone else (the framework
> maintainers) worrying about maintaining function such as HTTP request
> parsers, a lot of work won't have to be [re]done.
>
>
>> DRY isn't about saving time now, its about saving time six months
>> from now.
>>

>
> I suppose in this case it's DRTW (don't reinvent the wheel) but the
> same principle applies.


Well, yes- but it's also DRY, and while DRTW (like the acronym, btw)
helps to prevent your code from being unreadable to someone else,
DRY helps to ensure that when you have to change something you
don't have to worry about changing it in 37 and a half other places
at the same time. Especially given how notoriously difficult it is to
do automated testing for web development, that's essential.

Geremy Condra

Dotan Cohen 10-27-2009 08:52 PM

Re: Web development with Python 3.1
 
> Well, yes- but it's also DRY, and while DRTW (like the acronym, btw)
> helps to prevent your code from being unreadable to someone else,
> DRY helps to ensure that when you have to change something you
> don't have to worry about changing it in 37 and a half other places
> at the same time. Especially given how notoriously difficult it is to
> do automated testing for web development, that's essential.
>


That's what classes are for, no? Reuse code. I fail to see how using a
framework would reduce the need to use classes, provided that the need
exists.


--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

geremy condra 10-27-2009 09:34 PM

Re: Web development with Python 3.1
 
On Tue, Oct 27, 2009 at 4:52 PM, Dotan Cohen <dotancohen@gmail.com> wrote:
>> Well, yes- but it's also DRY, and while DRTW (like the acronym, btw)
>> helps to prevent your code from being unreadable to someone else,
>> DRY helps to ensure that when you have to change something you
>> don't have to worry about changing it in 37 and a half other places
>> at the same time. Especially given how notoriously difficult it is to
>> do automated testing for web development, that's essential.
>>

>
> That's what classes are for, no? Reuse code. I fail to see how using a
> framework would reduce the need to use classes, provided that the need
> exists.


....frameworks use classes. They just don't make you write all of them.

Geremy Condra

Diez B. Roggisch 10-27-2009 09:34 PM

Re: Web development with Python 3.1
 
Dotan Cohen schrieb:
>> Well, yes- but it's also DRY, and while DRTW (like the acronym, btw)
>> helps to prevent your code from being unreadable to someone else,
>> DRY helps to ensure that when you have to change something you
>> don't have to worry about changing it in 37 and a half other places
>> at the same time. Especially given how notoriously difficult it is to
>> do automated testing for web development, that's essential.
>>

>
> That's what classes are for, no? Reuse code. I fail to see how using a
> framework would reduce the need to use classes, provided that the need
> exists.
>


A webframework is *written* in python. Your whole line of argumentation
boils down to "I can write things myself in python, why use
libraries/frameworks". Yes. You can also delete your standard-lib, and
code everything in there yourself - with the same argument.

Using a framework is about proven solutions for common problems, letting
you focus on working on your actual application code.

Diez


All times are GMT. The time now is 01:43 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.