[Tutor] Dynamic/Weak Types and large projects

alan.gauld@bt.com alan.gauld@bt.com
Wed, 31 Jul 2002 16:41:12 +0100


> > 1) Dynamic vs Weak Types
> >
> > I have heard python referred to as having "weak" types - how does
> > this differ from "dynamic types" ?
> 
> This is actually exactly the opposite of how most Pythonistas would
> describe Python's type system -- Python has *strong* but dynamic
> typing.  

In its builtin functions yes, but not in its user defined 
functions. Thats why I drew the comparison with early Tcl
(which is now improved BTW) because Python is stronger typed
than Tcl but weaker than VB say which can specify the types 
of function parameters.

> biggest drawback of static languages -- since you don't need to test
> everything for type mismatches, most programmers *won't* test

Thats a drawback of the organization's culture not the language!
Thorough testing should be done in any language!

> > 2) General consensus is that for large projects strongly typed
> > languages are better.

> No, there is no proof of this -- or at least, there's no proof that
> *statically* typed languages are better 

There is quite a body of proof that static typing catches 
one particular type of error early - and hence more cheaply.
That particular type of error is particularly common on 
large projects buoilt by distributed teams. Hence it is 
an advantage for that specific type of large project.

However....

> of the experimental evidence these days supports the 
> idea that dynamic langauges are "better" in most 
> senses of the word -- shorter code, fewer errors, 
> faster release times.  

This is also true and for ,most projects built in a single 
location by a single team I would tend towards dynamic 
typing backed up by thorough exception hanbdling.

In fact even the distributed case cost dsavings may be 
negated since the increased develop[ment speed of dynamically 
typed languages may more than make up for the savings 
in compile time checking. But the jury ius still out on 
that one... 

There are all sorts of legalistic/contractual advantages 
to static typechecking at compile time - contractors are 
only allowed to deliver cleanly compiling code(no lint 
errors etc) so it can be used as a stick to beat up 
your suppliers and ensure minimal quality standards. 
Frankly if thats your reason you have bigger problems 
to deal with IMHO! but then I'm not a lawyer....

Alan G.