dynamic typing question

J

Jason Tesser

I work for at a college where I am one of 2 full-time developers and we are looking to program a new
software package fro the campus. This is a huge project as it will include everything from registration to
business office. We are considering useing Java or Python. I for one don't like Java because I feel the
GUI is clunky. I also think that we could produce quality programs faster in Python.

The other programmer here is very concerned about dynamic typing though in Python. He feels like this
would be too much of a hinderance on us and too easy for us to make a mistake and not catch it until
runtime making debugging harder.

OK what are your guys thoughts here? How have you all overcome the lack of static typing? Is Python a
bad decision here? By the way we will be using Postgres in the back if that matters to anyone.
 
J

Jarek Zgoda

Jason Tesser said:
I work for at a college where I am one of 2 full-time developers and
we are looking to program a new software package fro the campus. This
is a huge project as it will include everything from registration to
business office. We are considering useing Java or Python. I for one
don't like Java because I feel the GUI is clunky. I also think that
we could produce quality programs faster in Python.

The other programmer here is very concerned about dynamic typing
though in Python. He feels like this would be too much of a
hinderance on us and too easy for us to make a mistake and not catch
it until runtime making debugging harder.

OK what are your guys thoughts here? How have you all overcome the
lack of static typing? Is Python a bad decision here? By the way we
will be using Postgres in the back if that matters to anyone.

If Python is good for banks[1], insurance companies[2], guys that do big
booms[3] and other significant parties, why colleges are worry?

[1]. This month I heard that some bank in Spain decided to use Pyro
(Python Remote Objects).
[2]. I work in one of them.
[3]. Lawrence Livermoore National Laboratory. You know. These guys that
made the Bikini Islands disappeared.

Dynamic typing (with all other flexibility that Python offers) is a
wonderful thing. I'm really sick when I must write anything in
ObjectPascal.
 
D

Dang Griffith

I work for at a college where I am one of 2 full-time developers and we are looking to program a new
software package fro the campus. This is a huge project as it will include everything from registration to
business office. We are considering useing Java or Python. I for one don't like Java because I feel the
GUI is clunky. I also think that we could produce quality programs faster in Python.

The other programmer here is very concerned about dynamic typing though in Python. He feels like this
would be too much of a hinderance on us and too easy for us to make a mistake and not catch it until
runtime making debugging harder.

OK what are your guys thoughts here? How have you all overcome the lack of static typing? Is Python a
bad decision here? By the way we will be using Postgres in the back if that matters to anyone.
The point of 'interfaces' in Java is to support something like
dynamic typing. In Python, as with Java interfaces, you don't care
what an object *is*, only what it *does*.
Also, there are external programs (pychecker
(href="http://freshmeat.net/projects/pychecker") and pylint
(href="http://freshmeat.net/projects/pylint") that perform many of the
checks that you would get with a statically-typed language.
Finally, the standard Python distribution includes PyUnit for
developing unit tests, following the same principles as JUnit, et al.
If you create unit tests, you should be able to find run-time problems
pretty quickly. I'd recommend avoiding tests that make sure the
caller is passing the right "type" of object, though. If the test
crashes because the arguments can't *do* the thing the test requires,
either the test or the caller is wrong. Either way, you've found a
problem.
--dang
 
D

Dang Griffith

On Mon, 22 Dec 2003 13:23:55 GMT, Dang Griffith
Finally, the standard Python distribution includes PyUnit for
developing unit tests, following the same principles as JUnit, et al.
<snip>
The module is called unittest, though, not PyUnit.
--dang
 
C

Cameron Laird

I work for at a college where I am one of 2 full-time developers and we
are looking to program a new
software package fro the campus. This is a huge project as it will
include everything from registration to
business office. We are considering useing Java or Python. I for one
don't like Java because I feel the
GUI is clunky. I also think that we could produce quality programs
faster in Python. .
.
.
OK what are your guys thoughts here? How have you all overcome the lack
of static typing? Is Python a
bad decision here? By the way we will be using Postgres in the back if
that matters to anyone.
Along with everything others have already written--that
you want to focus on test-driven development, that Python
is a proven success in Serious Applications, and so on--
your description raises a few concerns in my mind:
1. Why, in your mind or your teammate's,
is dynamic typing a "lack"? What, pre-
cisely, is the benefit of static typing?
There are a number of legitimate
answers. It occurs to me that, without
precision on which interest you, we
might be missing an opportunity to
clarify "The Python Way" significantly.
2. Most application-level Python code
doesn't--and shouldn't!--employ dynamic
typing in any material way. Does that
help?
3. Postgres is good stuff. Its support for
Python has improved quite a bit over the
past few years.
4. My instinct tells me that, yes, you can
produce quality results quicker with Py-
thon.
5. In writing, "the GUI is clunky" about
Java, what do you mean? Are you refer-
ring to a particular IDE, or a specific
GUI toolkit? Java has several of each;
perhaps alternatives would suit you
better.
6. Are there alternatives to having the
two of you write a "package" from
scratch? A LOT of software for college
administration has been written already;
is none of it appropriate for your situ-
ation?
 
H

Hung Jung Lu

1. Why, in your mind or your teammate's,
is dynamic typing a "lack"? What, pre-
cisely, is the benefit of static typing?
There are a number of legitimate
answers. It occurs to me that, without
precision on which interest you, we
might be missing an opportunity to
clarify "The Python Way" significantly.

One static typing advantage I've run into:

When you change the name of a variable in a class, and re-compile the
program, the compiler shows you ALL places where compilation fails.
These could be hundreds of places in dozens of files. In dynamically
typed language like Python, you have to rely on text search, which
often yields many false positives, especially for common/overloaded
names like .count, .name, .type, etc. In statically-typed languages,
making name changes is not very painful, since the compiler will tell
you where exactly you need to follow up with the changes. In
dynamically typed language, you will have to manually write unit test
codes to ensure name consistency.

I am sure Python people have come up with strategies to deal with this
problem. That's what I'd like to hear. (Unit test is one route.) But
this is one place where I've found statically-typed compilers useful.
I mean, I have seen this discussion many times, but most responses
from Python users have not been realistic (often simply shrugging off
the problem and saying something like "compilers don't detect all the
bugs, blah blah blah".) I would like to hear more real-life experience
rather than academic conjectures.

regards,

Hung Jung
 
S

Skip Montanaro

HJL> One static typing advantage I've run into:

HJL> When you change the name of a variable in a class, and re-compile
HJL> the program, the compiler shows you ALL places where compilation
HJL> fails. These could be hundreds of places in dozens of files.

...

HJL> I am sure Python people have come up with strategies to deal with
HJL> this problem. That's what I'd like to hear. (Unit test is one

As others have pointed out, pychecker is good at catching these sorts of
problems.

HJL> I would like to hear more real-life experience rather than academic
HJL> conjectures.

I've used pychecker in real-life to detect these sorts of problems, in other
peoples' code no less, even though I have a (non-academic) position at
Northwestern University. ;-)

Skip
 
J

John Roth

Hung Jung Lu said:
(e-mail address removed) (Cameron Laird) wrote in message

One static typing advantage I've run into:

When you change the name of a variable in a class, and re-compile the
program, the compiler shows you ALL places where compilation fails.
These could be hundreds of places in dozens of files. In dynamically
typed language like Python, you have to rely on text search, which
often yields many false positives, especially for common/overloaded
names like .count, .name, .type, etc. In statically-typed languages,
making name changes is not very painful, since the compiler will tell
you where exactly you need to follow up with the changes. In
dynamically typed language, you will have to manually write unit test
codes to ensure name consistency.

I am sure Python people have come up with strategies to deal with this
problem. That's what I'd like to hear. (Unit test is one route.) But
this is one place where I've found statically-typed compilers useful.
I mean, I have seen this discussion many times, but most responses
from Python users have not been realistic (often simply shrugging off
the problem and saying something like "compilers don't detect all the
bugs, blah blah blah".) I would like to hear more real-life experience
rather than academic conjectures.

The OP said they would be using Test Driven Development. In TDD,
you write maybe a half dozen lines before running your test suite. If
it ran last time, and it didn't run this time, then you have maybe a
half dozen lines to check. Lots of people regard the 'undo' command
as a great debugger in this case.

Of course, if you write hundreds of lines before doing a compile,
then you will need all the help you can get.

John Roth
 
R

Robin Munn

Hung Jung Lu said:
One static typing advantage I've run into:

When you change the name of a variable in a class, and re-compile the
program, the compiler shows you ALL places where compilation fails.
These could be hundreds of places in dozens of files. In dynamically
typed language like Python, you have to rely on text search, which
often yields many false positives, especially for common/overloaded
names like .count, .name, .type, etc. In statically-typed languages,
making name changes is not very painful, since the compiler will tell
you where exactly you need to follow up with the changes. In
dynamically typed language, you will have to manually write unit test
codes to ensure name consistency.

I am sure Python people have come up with strategies to deal with this
problem. That's what I'd like to hear. (Unit test is one route.) But
this is one place where I've found statically-typed compilers useful.
I mean, I have seen this discussion many times, but most responses
from Python users have not been realistic (often simply shrugging off
the problem and saying something like "compilers don't detect all the
bugs, blah blah blah".) I would like to hear more real-life experience
rather than academic conjectures.

That sounds like exactly the sort of problem that the Bicycle Repair Man
project (http://sourceforge.net/projects/bicyclerepair/) is intended to
solve. It's a refactoring browser for Python code.

Caveat: I've not actually used Bicycle Repair Man myself, so I don't
know if there are any hidden gotchas. But I've heard very good things
about it from other people.

The name "Bicycle Repair Man", BTW, is a reference to a Monty Python
skit involving a superhero whose special power was repairing bicycles.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top