Questions about app design - OOP with python classes
Paul Rubin
http
Fri Mar 2 00:53:09 EST 2007
Steven D'Aprano <steve at REMOVEME.cybersource.com.au> writes:
> > That still sounds like an unreliable manual type system,
> It's unreliable in the sense that the coder has to follow the naming
> convention, and must have some bare minimum of sense. If your coders are
> morons, no naming convention will save you. (For that matter, nothing will
> save you.)
Well, type systems in programming languages have generally proven more
reliable and easier to deal with than having programmers track it all
manually-- that's why we don't all write in Forth ;-).
> But dimensioned units are still only part of the story. Joel describes the
> situation the early Word developers found: when you're writing a word
> processor, you are doing a LOT of conversions between screen coordinates
> and window pane coordinates. Both have the same type (a pair of ints),
> both have the same dimensional units (length/pixels) but they are
> semantically different. If you place the character "N" at coordinates 0,0,
> it makes a big difference if the coordinates are relative to the current
> window or relative to the screen.
You're right that this is not exactly dimensional analysis, but it
still seems to call for types and conversion functions, rather than
naming conventions. I guess they were writing that stuff in C++, so
I'd have expected the compiler to handle the conversions through casts
with no runtime cost except when an actual conversion was needed. In
Haskell I believe it would be similar.
More information about the Python-list
mailing list