On Mon, 13 Dec 2004 19:33:25 -0800, projecktzero wrote:
> We do web programming. I suspect that OO apps would behave as good as
> procedural apps, and you'd get the benefit of code reuse if you do it
> properly. Code reuse now consists of cutting and pasting followed by
> enough modification that I wonder if it was worth it to cut and paste
> in the first place.

OO is a huge, ginormous, amazingly large, unspeakably awesome,
can't-believe-anyone-ever-lived-without-it win... but not necessarily OO
as it is presented in Software Engineering class due to the unusual nature
of web programming.

Tell him to check out HTML::Mason, and be sure to work with it long enough
to actually use some of its features. Once he's hooked (and it really is
an awesome framework; Amazon is supposed to use it and while I'm sure it
is highly customized I can definitely see it), explain to him that the
various components are really objects, complete with quite a lot of the
object features like inheritance, even if it doesn't look it.

If he resists this and declares Mason to be "crap", then with all due
respect you've got a blowhard who refuses to learn on your hands, and in a
perfect world he'd be stripped of code responsibility and moved somewhere
where he can't hurt anything. (He may merely not like it; I reserve the
strong statements in the previous sentence for the case where he actually
dismisses it with prejudice.) In the meantime, I've had great luck in Perl
environments programming in OO anyhow, as long as you have reasonably
independent responsibilities, and eventually the advantages do not go
unnoticed. Perl gets bashed on around here (in a good natured way) but
there are certainly worse languages; generally when I want to do something
the Right Way it provides a way to avoid code duplication, though it is
usually more circuitous and complex than in Python.

Ultimately, of course, the true problem isn't that you aren't coding OO,
it is the use of Copy and Paste Programming. OO is one path out, but only
one. (Perl is strong enough that one can make a case for going functional,
though I strongly prefer a functional/OO hybrid that builds on OO but
freely borrows functional paradigms at will.) 

http://www.c2.com/cgi/wiki?CopyAndPasteProgramming

The problem with web programming is that you can *get away with*
"procedural" programming because the partitioning of the problem into web
pages provides a primitive, but marginally effective partitioning of the
problem into discrete components. Thus, unless you are running
*everything* through the exact same "web page" (CGI script probably in
this case), you aren't doing true procedural; the CGI scripts function as
primitive objects themselves, enough to let you get farther than you could
in a monolithic program and fool yourself into thinking you're safe, but
not strong enough to build a large-scale system with high-quality code
(i.e., low duplication).

But you still suffer.

ObPython (serious though): Which Python framework is the most Mason like?
(I'm more interested in the component infrastructure than the exact syntax
of the files; I'm not so worried about embedding Python into the HTML. I
think it might be Zope but I haven't tried enough of them to know.)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to