Python for large projects

Dave Brueck dave at pythonapocrypha.com
Tue Mar 23 21:07:06 CET 2004


gabor wrote:
> > I want to call attention to this.  Dave and I appear to be in
> > agreement that, while common wisdom in our field is that C++,
> > Java, and so on, are serious languages that are the only
> > realistic choices for large projects, we are both saying that
> > they're at a particular DISadvantage there.  If you have a
> > big job, you *particularly* need to look at Python (or Erlang,
> > or Eiffel, or ...)
> > -- 
>
> i wanted to use python for a project in our company... we wanted to
> build a fairly big system/program.
>
> but when i recommended python, i got a question like:
> (previously all the programs were written in java)
> "if one of our programmers changes a method in a class/interface, we
> immediately will know about it, because the next program-rebuild will
> simply fail. but if we would use python, we wouldn't find it out".

Say "Bzzt! Wrong!" :) In C++ this is a no brainer because the compiler simply
cannot catch all bugs introduced by interface refactoring, e.g. changing

void bar(int a, int c=0)

to

void var(int a, int b, int c=0)

can result in hidden bugs. Even in Java though, you simply cannot rely on the
compiler for this sort of thing (in the simplest case, an interface refactoring
that re-orders some of the parameters with same types will not be caught - if
the developers form the habit of relying on the compiler they'll be safe for
many types of refactoring and then get burnt by laziness at some point along
the way).

In reality you need to look at *each* use of the interface to know (1) what
sort of change makes sense and (2) if the changes you made didn't break
anything. You can cut down on the work required by using a nice refactoring
IDE, or better yet, with proper testing (if unit tests don't work well, then
some system tests are better than nothing) but just relying on the compiler is
a big no-no - in the above examples, relying on the compiler covers bugs up!

Their argument that Python is unsuitable for large projects has little to do
with Python at all, and instead just reveals a poor development practice that
everybody should avoid. I would ask them to cite a real world example rather
than hypothetical "what-ifs" because the refactoring of an interface is almost
always accompanied by a semantic change to the interface, and again the
compiler can't really help there.

-Dave





More information about the Python-list mailing list