large-scale app development in python?

Dave Brueck dave at pythonapocrypha.com
Sat Aug 23 16:31:41 CEST 2003


gabor <gabor at z10n.net> wrote in message news:<mailman.1061597346.828.python-list at python.org>...
> hi,
> 
> at the company where i'm working we have to rewrite a part of our
> java-based application in a different language.

Why?

> -you can't compile python, as you can c++ or java => there's no type
> checking before starting the program => if one programmer changes a
> method name or method signature, then how do we know we changed all the
> code that calls that method?

It's not really that different in Python - you need to check the
callers. It's tempting to say that, for example, the C++ compiler will
provide a safety net for you, but it's not always reliable. For
example:

int func(int a, int c=0);

If a programmer changes the method signature to:

int func(int a, int b, int c=0)

then some bugs can still slip through even though the compiler
declares the program "good". It's just a fact of life that refactoring
a method signature, regardless of the language, implies that you
double-check the callers. Anything less is a gamble.

But, in practice it's not as bad as it sounds for Python or any other
language because of the nature of programs - as they get bigger, most
of the refactoring you do will be "local" to a small subset of
modules. The coupling of the separate modules is such that you don't
have every part of the program talking to every other part of the
program. In any language, APIs that are used extensively throughout
require more thought and design, and more work to refactor. *In
practice* Python isn't really any different in this area.

> how do you solve these kind of problems? i know that unit tests are a
> good thing, but i don't know if they can help in this situation?

Yes, they can. It's not that you write unit tests to test for this
specific problem - you write tests for the functionality of your
application - and you get coverage on these sorts of problems mostly
for free. IOW, these problems *can* be a bigger factor if you don't
have good tests, but if you don't have good tests then you are likely
to have even bigger problems than these anyway. :)

> are there any people who wrote a big program in python? how did they
> handle these problems?

Yes, there are quite a few large Python applications out there. My
personal opinion is that these problems don't occur in practice as
often as they do in theory. :)

> or python simply isn't suited to write bigger (more complex) apps?

In many ways languages like Python are *more* suited than C++ or Java
for larger and more complex applications. There are many reasons why
this is the case but if nothing else there's this one: for an
equivalent set of functionality, the Python version is often much,
much shorter, so you can implement *way* more functionality before you
begin running into problems that are inherent in large applications.

That is a pretty big benefit in and of itself, and a direct "bonus"
side effect is that you have to change a lot less code to change some
portion of your application. So, if your application evolves over time
(as they always do), then there's less risk if you use Python or a
similar higher-level language. If you can't clearly define all your
requirements up front, you can adapt more easily if you use Python. If
you just plain decided wrong in some aspect of your architecture, you
have a better chance of being able to correct your mistake if you used
Python.

-Dave




More information about the Python-list mailing list