comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: Is strong typing worth the cost?
Date: Fri, 03 May 2002 16:06:37 GMT
Date: 2002-05-03T16:06:37+00:00	[thread overview]
Message-ID: <3CD2B5E5.3203E48F@san.rr.com> (raw)
In-Reply-To: 3CD2A86C.85B4CF8@despammed.com

Wes Groleau wrote:
> OK, I take back the comment about your Ada knowledge.
> Still, only one of these declares a type.  Your terminology
> induced misunderstanding.

Fair enough. Actually, when I said "every type has to be declared
twice", I was thinking about subprogram declarations, so yes, my bad.

Limited types wind up being declared twice, in general, yes? Once in the
"public" part of the spec and once in either the private part or the
body? Subprogram names show up at least twice (at the start and end of
the subprogram) and usually in the package spec too. Etc.

> > Now, if I change X to be a date instead of an age, how many places to I
> > need to change it? I need to change it two places in Y's body and one
> 
> Sure.  But changing something from "Date" to "Age" in the middle
> of the project is a sure sign you didn't have a clue what
> you were working on when you started!  Changing from an integer
> to a disk-based database is even more extreme (pun intended).

Well, yes and no. One of the points of XP is that you *don't* know
everything you're going to put in the code before you start. Secondly,
again, XP is for where the specs change over the lifetime of the
development. If you're running (say) a payroll system, you can't
possibly predict what Congress is going to want to see on tax reports
three years from now. XP explicitly says don't even *look* at
requirements that are more than a week away from being implemented.

I picked date->age specifically because I used to write life insurance
proposal software, and that kind of change got to be so common that I
made up a special UI widget that would accept either a date or an age,
as an example. 

> When they are used in a place where it truly doesn't
> matter, a generic or a tagged type might be appropriate.

That only works if you know when you declare the type that it's going to
be used in ways where it doesn't matter. I.e., you have to plan ahead to
make it a generic or tagged type. And if you change it from non-generic
to generic, you now have to go find all the places you used the
non-generic type and instantiate the right thing, and etc. Again, a lot
more changes than you would need with a dynamically-typed system.

And then when you refactor and move some of the routines into a
different package, then you have to find every reference to it and
change the "with" clause and the "use" clause or the fully-qualified
calls.
 
> In either case, scripting a global change is quite easy.

Well, unless there's other people working on other stuff in the same
package, yes. :-?  No question that you can *work around* all the extra
work that Ada makes you do when you frob requirements twice a week. But
it's certainly more efficient to code in a language with less
redundancy, and XP advocates claim it's more efficient to get a working
result as well.

> > > Ada does not require a subprogram to be written to compile
> > > a call to it.  It does require it to be written (or a "stub"
> > > for it) to execute the call.
> >
> > It requires the subprogram to be declared to compile a call to it, and
> > it requires the subprogram to be implemented to link. (The difference
> 
> No, to link you only need a stub, if you are not debugging
> that subroutine.  If you are, the obviously it has to be written
> either way.

You've still implemented the stub. To run the test, you still have to
code the declaration of the subprogram and you still have to code the
body of the subprogram. The body doesn't have to be *right*, but it
still has to be coded.

> > between being able to compile and being able to link is kind of academic
> > when the goal is to do both at least five times an hour, so I wasn't
> 
> You make it sound like XP is a euphemism for rapid trial and error.

Yes, amongst other techniques. It's a whole raft of maybe a dozen
different techniques that basically make rapid trial and error work
better (so it's claimed) than thinking things out well in advance and
planning before coding. One of the rules is that every bit of knowledge
in the program is coded exactly once, which Ada doesn't do, as
demonstrated above. Another of the rules is that you never touch the
productive code unless there's a test that fails. I suppose you could
count "won't compile" as a failed test, but since XP uses Smalltalk and
the only reason for something not to compile is a very localized syntax
error, its hard to say whether an XPer would say "fails to compile"
counts as a failing test.
 
> Why not make a hundred copies of the program each cycle,
> make random changes, and keep the few that look promising?
> Genetic algorithm--sort of.

Well, you could, but it wouldn't be XP.
 
> Seriously, when I have to debug Ada I can (usually)
> EASILY compile and run five or ten times an hour.
> But I rarely need five or ten tries to make it work.

No, the point of 5 or 10 changes an hour is that you implement 5 or 10
requirements per hour. 
 
> And when it's old code, those irritating declarations
> help my changes to be based on understanding instead of
> guessing or random changes.

I'm not trying to say XP is superior to the normal mechanisms used by
Ada. I'm just saying that *if* you're doing XP, doing it with something
like Smalltalk is better than doing it with something like Ada, in part
because of the strictness of Ada's type system that requires extra work
to make things compile/link and extra redundancy that assures the
compiler you mean what you said.

In other words, saying that strict typing is always superior is wrong,
unless you want to throw away all the experience of successful XP-based
development as being irrelevant or bogus in some other way. I.e., there
*is* evidence that weak typing buys you something, namely, the ability
to be more agile in the face of rapidly-changing specifications.

-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
   The 90/10 rule of toothpaste: the last 10% of 
         the tube lasts as long as the first 90%.



  reply	other threads:[~2002-05-03 16:06 UTC|newest]

Thread overview: 166+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-28 17:07 Is strong typing worth the cost? dmjones
2002-04-29 15:22 ` Ted Dennison
2002-04-29 15:53   ` Pat Rogers
2002-04-29 18:37   ` dmjones
2002-04-29 18:50     ` Pat Rogers
2002-04-29 19:00     ` Darren New
2002-04-30 11:50     ` Marc A. Criley
2002-04-30 13:24       ` dmjones
2002-04-30 15:03         ` Jim Rogers
2002-04-30 16:48           ` dmjones
2002-04-30 17:45             ` Marin David Condic
2002-05-01 21:36               ` Brian Gaffney
2002-04-30 18:20             ` tmoran
2002-04-30 19:00               ` Marin David Condic
2002-05-01 15:20                 ` dmjones
2002-05-01 16:07                   ` Marin David Condic
2002-05-02  5:00                     ` Simon Wright
2002-05-02  7:55                   ` Martin Dowie
2002-05-01 16:51                 ` Darren New
2002-05-01 17:25                   ` Marin David Condic
2002-05-02 16:09                     ` Darren New
2002-05-03 13:46                       ` Marin David Condic
2002-05-03 22:54                         ` Darren New
2002-05-01 18:22                 ` tmoran
2002-05-01 18:50                   ` Marin David Condic
2002-05-01 20:30                   ` Dan Andreatta
2002-05-01 21:47                     ` Larry Kilgallen
2002-05-02 15:43                     ` Wes Groleau
2002-04-30 19:01             ` Preben Randhol
2002-04-30 19:28               ` Preben Randhol
2002-04-30 20:20                 ` Marin David Condic
2002-05-01  8:36                   ` Pascal Obry
2002-05-01 11:50                     ` Gary Scott
2002-05-01 13:39                       ` Marin David Condic
2002-05-02  2:24                         ` Darren New
2002-05-02 15:47                           ` Wes Groleau
2002-05-02 16:37                             ` Darren New
2002-05-02 19:59                               ` Chad R. Meiners
2002-05-02 21:48                                 ` Darren New
2002-05-02 22:16                                   ` Wes Groleau
2002-05-02 23:52                                     ` Darren New
2002-05-03  0:17                                       ` Aidan Skinner
2002-05-03  0:31                                         ` Aidan Skinner
2002-05-03 15:10                                       ` Wes Groleau
2002-05-03 16:06                                         ` Darren New [this message]
2002-05-06 16:37                                           ` Wes Groleau
2002-05-06 17:40                                             ` Darren New
2002-05-07  2:06                                               ` tmoran
2002-05-07 15:21                                                 ` Darren New
2002-05-07 19:11                                                   ` Preben Randhol
2002-05-03 15:31                                       ` Wes Groleau
2002-05-03 16:21                                         ` Darren New
2002-05-06 15:33                                           ` Wes Groleau
2002-05-06 16:30                                             ` Darren New
2002-05-03 15:38                                       ` Wes Groleau
2002-05-03 16:07                                         ` Marin David Condic
2002-05-03 19:51                                       ` Randy Brukardt
2002-05-03 20:55                                         ` Ed Falis
2002-05-04 16:34                                           ` Brian Rogoff
2002-05-03  0:22                                   ` Chad R. Meiners
2002-05-03  0:48                                     ` Darren New
2002-05-03 12:11                                       ` Chad R. Meiners
2002-05-03 14:27                                         ` Marin David Condic
2002-05-04  0:23                                           ` Darren New
2002-05-06 17:54                                             ` Marin David Condic
2002-05-07 15:28                                               ` Darren New
2002-05-07 17:54                                                 ` Chad R. Meiners
2002-05-03 14:01                           ` Marin David Condic
2002-05-03 23:41                             ` Gary Scott
2002-05-06 18:05                               ` Marin David Condic
2002-05-01 14:19                       ` Pascal Obry
2002-05-01 13:27                     ` Marin David Condic
2002-05-01 14:28                     ` Wes Groleau
2002-05-01 15:25                       ` Marin David Condic
2002-05-02 15:51                       ` Wes Groleau
2002-05-02 16:47                         ` Gary Scott
2002-05-02 18:24                           ` Preben Randhol
2002-05-02 18:48                             ` Dan Nagle
2002-05-03  8:44                               ` Preben Randhol
2002-05-03 10:17                                 ` Gary Scott
2002-05-03 10:48                                   ` Preben Randhol
2002-05-03 13:13                                     ` Gary Scott
2002-05-03 14:40                                       ` Preben Randhol
2002-05-03 14:32                                 ` Dan Nagle
2002-05-02 17:26                         ` Larry Hazel
2002-05-02 18:12                           ` Wes Groleau
2002-05-02 18:40                             ` Preben Randhol
2002-05-02 21:54                               ` Wes Groleau
2002-05-02 18:54                           ` Gary Scott
2002-05-02 21:56                             ` Wes Groleau
2002-05-26 17:56                           ` Robert I. Eachus
2002-05-26 22:04                             ` Brian Rogoff
2002-05-27 23:26                               ` Robert I. Eachus
2002-05-28 15:26                             ` Marin David Condic
2002-05-02 11:30                     ` Larry Kilgallen
     [not found]                     ` <3CCFD76A.A60BB9Organization: LJK Software <Sb8D81Zz$HcE@eisner.encompasserve.org>
2002-05-02 16:12                       ` Darren New
2002-04-30 21:17             ` Jim Rogers
2002-04-30 21:30               ` Darren New
2002-05-07 12:17           ` Colin Paul Gloster
2002-05-07 22:11             ` Hyman Rosen
2002-04-30 15:39         ` Marin David Condic
2002-05-01 14:39           ` Wes Groleau
2002-05-01 15:42             ` Marin David Condic
2002-05-02 20:17               ` Jeffrey Carter
2002-05-03 14:40                 ` Marin David Condic
2002-05-26 16:51               ` Robert I. Eachus
2002-05-28 15:16                 ` Marin David Condic
2002-04-30 17:02         ` Chad R. Meiners
2002-04-30 17:27           ` Darren New
2002-04-30 20:15             ` Chad R. Meiners
2002-04-30 20:42               ` Marin David Condic
2002-05-02 12:00                 ` Marc A. Criley
2002-05-02 15:20                   ` Larry Kilgallen
2002-05-02 16:19                   ` Darren New
2002-05-03 14:44                   ` Marin David Condic
2002-04-30 21:40               ` Darren New
2002-04-30 21:43             ` tmoran
2002-04-30 22:38               ` Darren New
2002-04-30 18:04           ` Marin David Condic
2002-04-30 17:27         ` Jeffrey Carter
2002-04-30 17:35         ` Marc A. Criley
2002-05-01  4:01         ` Richard Riehle
2002-04-29 16:02 ` Marin David Condic
2002-05-01  0:31 ` dmjones
2002-05-01  8:05   ` Preben Randhol
2002-05-01  8:07   ` Preben Randhol
2002-05-01 14:32   ` Mike Silva
2002-05-01 15:52     ` Marin David Condic
2002-05-02 16:17     ` Wes Groleau
2002-05-02 18:53       ` tmoran
2002-05-02 18:58         ` Pat Rogers
2002-05-01 15:35   ` Jim Rogers
2002-05-01 16:17     ` Marin David Condic
2002-05-01 18:42     ` dmjones
2002-05-01 20:12       ` Dan Andreatta
2002-05-01 20:19       ` Darren New
2002-05-01 22:17         ` Jeffrey Carter
2002-05-02 16:18           ` Wes Groleau
2002-05-01 21:46       ` Larry Kilgallen
2002-05-01 22:21       ` Jeffrey Carter
2002-05-02 11:28         ` John English
2002-05-02 16:18           ` Darren New
2002-05-02 16:41             ` Larry Kilgallen
2002-05-02 18:28               ` Preben Randhol
2002-05-02 19:53                 ` Larry Kilgallen
2002-05-03 12:12                 ` Andrzej Filip
2002-05-03 10:14             ` Georg Bauhaus
2002-05-26 22:46               ` Robert I. Eachus
2002-05-27  8:10           ` Florian Weimer
2002-05-01 22:47       ` Jim Rogers
2002-05-01 16:32   ` Jeffrey Carter
2002-05-01 17:59     ` Marin David Condic
2002-05-01 19:08     ` Wes Groleau
2002-05-01 21:10   ` Brian Gaffney
2002-05-03  2:45 ` dmjones
2002-05-03  7:59   ` Martin Dowie
2002-05-03  8:43     ` Preben Randhol
2002-05-03  8:55       ` Martin Dowie
2002-05-03  8:51   ` Preben Randhol
  -- strict thread matches above, loose matches on Subject: below --
2002-04-29 19:21 Beard, Frank [Contractor]
2002-04-29 20:15 ` dmjones
2002-04-29 23:26 Beard, Frank [Contractor]
2002-04-30 18:08 Beard, Frank [Contractor]
2002-05-01 11:07 ` David Gillon
2002-04-30 20:32 Beard, Frank [Contractor]
2002-04-30 21:34 Gralia, Mars  J.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox