comp.lang.ada
 help / color / mirror / Atom feed
From: kcline@optelnow.net (Kevin Cline)
Subject: Re: Future with Ada
Date: 11 Mar 2002 10:43:47 -0800
Date: 2002-03-11T18:43:48+00:00	[thread overview]
Message-ID: <dcfe911f.0203111043.53a94cc4@posting.google.com> (raw)
In-Reply-To: a68ns5$23nj$1@msunews.cl.msu.edu

"Chad R. Meiners" <crmeiners@hotmail.com> wrote in message news:<a68ns5$23nj$1@msunews.cl.msu.edu>...
> "Kevin Cline" <kcline@optelnow.net> wrote in message
> news:dcfe911f.0203071252.582e0401@posting.google.com...
> 
> > I used to happily program this way until I realized people
> > (including me, after a few weeks)
> > trying to read my code were drowning in details.  Now I limit
> > myself to one level of nesting per function, unless some
> > performance analysis proves the function call overhead is too great.
> >
> > It's true that the complexity has to be somewhere, but it's not necessary
> > nor desirable that it all be in one place.
>  
> > I find it much easier to understand five ten-line functions
> > than to understand one fifty-line function.
> 
> If you had read the post you are replying to carefully, you would have
> realized that the Marin is not advocating a practice that requires you to
> always favor using deeply nested if statements.  He is stating that there
> are cases in which using nested if statements is the most appropriate
> solution.
> 
> You seem to be stating that there is never a case is which nested ifs are
> appropriate (barring speed constraints).  I find this claim very difficult
> to believe.  Is this the claim you really want to be making?

That's pretty much it.   Functions with nested ifs are hard to code
correctly,
and hard to understand.  Worst, they're hard to test competely.  A
single function is the smallest unit that can be tested.  Separating
the top-level branches into separate functions allows each branch to
be tested separately.

Some people may enjoy painstakingly creating and verifying a complex
function.
I find that my accuracy improves if I write several small functions
that
can be easily read and tested.

Additionally, I find that it's very often the case that a set of
nested ifs would be better expressed in another way -- perhaps via
data and a simple
lookup function, or as a set of subclasses.  I find that breaking up
the
function makes the overall structure more apparent.



  reply	other threads:[~2002-03-11 18:43 UTC|newest]

Thread overview: 264+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-09 17:59 Future with Ada Michal Nowak
2001-11-10  0:44 ` Adrian Hoe
2001-11-10 13:28 ` Frode Tennebø
2001-11-10 23:09   ` Michal Nowak
2001-11-11 15:10     ` Preben Randhol
2001-11-11 22:31       ` Michal Nowak
2001-11-10 17:31 ` Ted Dennison
2001-11-10 23:09   ` Michal Nowak
2001-11-25  9:50   ` ben
2001-11-26 15:21     ` Marin David Condic
2001-11-26 19:48       ` Larry Kilgallen
2001-11-26 20:59         ` Marin David Condic
2001-11-26 23:33           ` Jerry Petrey
2001-11-27 14:24             ` Marin David Condic
2001-11-26 22:56         ` Ted Dennison
2001-12-01 18:43     ` Richard Riehle
2001-12-01 21:29       ` Suzie Cube
2001-12-10 16:25         ` Marin David Condic
2001-12-10 17:03           ` Larry Hazel
2001-12-10 17:19             ` Ted Dennison
2001-12-10 17:34               ` Marin David Condic
2001-12-10 18:10                 ` Larry Kilgallen
2001-12-10 18:25                   ` Marin David Condic
2001-12-02  0:19       ` IsraelRT
2001-12-02  0:46       ` Brian Rogoff
2001-12-02 19:58         ` Richard Riehle
2001-12-03 17:25           ` Wes Groleau
2001-12-10 16:39             ` Marin David Condic
2001-12-10 20:30               ` Robert C. Leif, Ph.D.
2001-12-11 15:15                 ` Marin David Condic
2001-12-11 16:56                   ` Darren New
2001-12-11 17:14                     ` Marin David Condic
2001-12-12  1:47                       ` Richard Riehle
2001-12-12  2:47                         ` Larry Kilgallen
2001-12-12  6:38                           ` Mark Biggar
2001-12-12 10:53                             ` Larry Kilgallen
2001-12-12 14:35                               ` Ted Dennison
2001-12-12 17:45                                 ` Peter Hend�n
2001-12-12 19:35                                 ` Mark Lundquist
2001-12-12 20:55                                   ` Ted Dennison
2001-12-16 13:34                           ` Georg Bauhaus
2001-12-12 14:55                         ` Marin David Condic
2001-12-12 18:02                           ` tmoran
2001-12-22 19:58                           ` Gerhard Häring
2001-12-28 21:12                             ` Containers package Eric Merritt
2001-12-29 14:11                               ` Michael Erdmann
2001-12-29 23:03                                 ` Eric Merritt
2001-12-31  2:58                                   ` Nick Roberts
2001-12-31 15:09                                     ` Eric Merritt
2001-12-31 23:19                                       ` Containers package (Tenet) Nick Roberts
2002-01-01  5:45                                     ` Containers package Ted Dennison
2002-01-01 23:30                                       ` Nick Roberts
2002-01-02  0:26                                         ` Ted Dennison
2001-12-29 22:13                               ` Marc A. Criley
2001-12-12 21:49                       ` Future with Ada Darren New
2001-12-14 20:22                         ` Mark Lundquist
2001-12-11 20:36                     ` XML and Ada was " Robert C. Leif, Ph.D.
2001-12-12  8:33                   ` rob
2001-12-12 15:03                     ` Marin David Condic
2001-12-16 13:48                       ` Georg Bauhaus
2001-12-16 16:17                         ` Georg Bauhaus
2001-12-16 16:21                           ` Georg Bauhaus
2001-12-17 15:10                         ` Marin David Condic
2001-12-17 22:32                           ` Ian S. Nelson
2001-12-17 23:11                             ` Marin David Condic
2001-12-18 15:49                             ` Robert C. Leif, Ph.D.
2001-12-18 16:41                               ` Marin David Condic
2001-12-19 16:33                                 ` Mr. Caffiene
2001-12-19 17:57                                   ` Marin David Condic
2001-12-19 21:07                                     ` Ian S. Nelson
2001-12-19 21:20                                       ` Marin David Condic
2001-12-19 18:36                                   ` Robert C. Leif, Ph.D.
2001-12-19 19:49                                     ` tmoran
2001-12-19 20:16                                       ` Eric Merritt
2001-12-19 21:11                                         ` Marin David Condic
2001-12-21 14:15                                           ` Eric Merritt
2001-12-20 19:50                                       ` Ted Dennison
2001-12-20 21:37                                         ` Hyman Rosen
2001-12-21 15:42                                           ` Ted Dennison
2001-12-19 20:37                                     ` Ian S. Nelson
2001-12-19 23:36                                   ` Michal Nowak
2001-12-19 23:36                                 ` Michal Nowak
2002-01-21 22:28                                   ` Harri J Haataja
2001-12-18 12:56                           ` Georg Bauhaus
2001-12-12 17:03                     ` Ian S. Nelson
2001-12-13 17:43                     ` Mark Lundquist
2001-12-13 20:13                       ` Marin David Condic
2001-12-14 19:49                         ` Mark Lundquist
2001-12-14 19:59                           ` Pat Rogers
2001-12-14 21:00                             ` Marin David Condic
2001-12-14 23:02                               ` Pat Rogers
2001-12-17  8:15                                 ` Mark Lundquist
2001-12-17 15:27                                   ` Pat Rogers
2001-12-17 16:29                                     ` Brian Rogoff
2001-12-17 17:05                                       ` Marin David Condic
2001-12-17 15:43                                 ` Marin David Condic
2001-12-17  8:15                               ` Mark Lundquist
2001-12-17 16:03                                 ` Marin David Condic
2001-12-17  8:15                             ` Mark Lundquist
2001-12-14 20:31                           ` James Rogers
2001-12-15  1:33                             ` Richard Riehle
2001-12-15 16:35                               ` Robert C. Leif, Ph.D.
2001-12-16 14:09                               ` Georg Bauhaus
2001-12-16 15:32                                 ` Eric Merritt
2001-12-17 16:31                               ` Marin David Condic
2001-12-15  2:44                             ` Eric Merritt
2001-12-14 20:39                           ` Marin David Condic
2001-12-18 23:01                             ` Mark Lundquist
2001-12-19 15:00                               ` Marin David Condic
2001-12-20  7:23                                 ` tmoran
2001-12-20 22:30                                 ` tmoran
2001-12-20 22:43                                   ` Marin David Condic
2001-12-19 20:50                               ` Wes Groleau
2001-12-19  0:12                             ` Portable GUI (was Re: Future with Ada) Mark Lundquist
2001-12-19  7:36                               ` Robert C. Leif, Ph.D.
2001-12-20  5:00                                 ` Steve Doiel
2001-12-20  6:19                                   ` Robert C. Leif, Ph.D.
2001-12-20 14:33                                   ` Marin David Condic
2001-12-20 20:53                                 ` Ted Dennison
2001-12-20 21:14                                   ` Marin David Condic
2001-12-21 14:53                                     ` Ted Dennison
2001-12-21 15:08                                       ` Marin David Condic
2001-12-21 16:40                                         ` Ted Dennison
2001-12-21 16:26                                   ` Robert C. Leif, Ph.D.
2001-12-19 15:07                               ` Marin David Condic
2001-12-19 15:14                               ` Marin David Condic
2001-12-19 16:53                               ` Darren New
2001-12-19 17:50                                 ` Marin David Condic
2001-12-20 19:37                                   ` Richard Riehle
2001-12-20 20:05                                     ` Ted Dennison
2001-12-20 20:07                                     ` Marin David Condic
2001-12-20 20:28                                     ` Stephen Leake
2001-12-21 17:18                                       ` Richard Riehle
2001-12-22 18:16                                     ` Michal Nowak
2001-12-02 20:26         ` Future with Ada Michal Nowak
2001-12-02 19:55       ` Michal Nowak
2001-12-03 14:53         ` Ted Dennison
2001-12-07 16:54         ` Richard Riehle
2001-12-07 17:14           ` Ted Dennison
2001-12-09 10:56           ` Thomas Mueller
2001-12-09 13:57             ` David C. Hoos, Sr.
2001-12-11 17:45           ` Michal Nowak
2001-12-03 14:52       ` Ted Dennison
2001-12-12 21:56       ` John Kern
2002-02-26  2:22       ` Michael Card
2002-02-26  4:12         ` Jim Rogers
2002-02-27  1:23           ` Adrian Hoe
2002-02-27 17:51           ` Warren W. Gay VE3WWG
2002-02-28 17:00             ` Richard Riehle
2002-02-28 21:24               ` Warren W. Gay VE3WWG
2002-02-28 17:45             ` Michal Nowak
2002-02-28 18:53               ` Hyman Rosen
2002-02-28 19:24                 ` Ed Falis
2002-03-01  0:52                   ` Adrian Hoe
2002-03-01 18:11                     ` Pascal Obry
2002-03-02  1:20                       ` Adrian Hoe
2002-02-28 21:43                 ` Wes Groleau
2002-03-01  5:18                 ` Richard Riehle
2002-03-01  5:23                   ` Dave Poirier
2002-03-01 16:45                   ` Michal Nowak
2002-03-01 11:10                 ` Georg Bauhaus
2002-03-03  8:28                   ` Hyman Rosen
2002-03-05 18:40                   ` Jacob Sparre Andersen
2002-03-01 16:48                 ` Michal Nowak
2002-03-01 17:26                 ` Jeffrey Carter
2002-03-03  8:26                   ` Hyman Rosen
2002-03-03 13:28                     ` Larry Kilgallen
2002-03-03 17:47                     ` Chad R. Meiners
2002-03-04 16:30                       ` Hyman Rosen
2002-03-04 19:28                         ` Chad R. Meiners
2002-03-05 17:03                           ` Warren W. Gay VE3WWG
2002-03-05  1:41                         ` Richard Riehle
2002-03-05 21:35                           ` Wes Groleau
2002-03-05 22:04                             ` Marin David Condic
2002-03-06  8:33                               ` Dmitry A. Kazakov
2002-03-06 11:46                               ` Frank J. Lhota
2002-03-06 15:03                                 ` Marin David Condic
2002-03-07 16:08                                   ` Georg Bauhaus
2002-03-07 16:25                                     ` Marin David Condic
2002-03-09 14:51                                   ` Gary Scott
2002-03-09 15:13                                     ` Marin David Condic
2002-03-09 15:54                                     ` named control statements (was: Future with Ada) Wes Groleau
2002-03-09 16:40                                       ` Gary Scott
2002-03-09 20:53                                       ` Jeffrey Carter
2002-03-06 16:36                               ` Future with Ada Georg Bauhaus
2002-03-06 17:27                                 ` Marin David Condic
2002-03-07 16:04                                   ` Georg Bauhaus
2002-03-07 16:42                                     ` Marin David Condic
2002-03-11 13:52                                       ` Georg Bauhaus
2002-03-11 20:02                                       ` Wes Groleau
2002-03-11 23:56                                         ` Marin David Condic
2002-03-12 16:47                                           ` code partitioning (was: Future with Ada) Wes Groleau
2002-03-12 17:56                                             ` Marin David Condic
2002-03-13 13:42                                               ` labeling (was: partitioning (was: Future)) Wes Groleau
2002-03-14 12:46                                                 ` Michal Nowak
2002-03-14 17:27                                                   ` Wes Groleau
2002-03-14 20:27                                                     ` Marin David Condic
2002-03-15  8:00                                                 ` Tarjei T. Jensen
2002-03-15 15:10                                                   ` Wes Groleau
2002-03-14 15:27                                               ` code partitioning (was: Future with Ada) John R. Strohm
2002-03-15 14:15                                                 ` Ted Dennison
2002-03-16 10:37                                                   ` Kevin Cline
2002-03-13 12:26                                           ` Future with Ada John English
2002-03-13 14:15                                             ` Marin David Condic
2002-03-14  3:34                                               ` Wes Groleau
2002-03-14 15:36                                                 ` John R. Strohm
2002-03-14 17:43                                                   ` Wes Groleau
2002-03-14 11:59                                               ` John English
2002-03-13 15:16                                           ` Kevin Cline
2002-03-13 17:55                                             ` Marin David Condic
2002-03-14 15:21                                           ` John R. Strohm
2002-03-07 20:52                                   ` Kevin Cline
2002-03-07 22:12                                     ` Chad R. Meiners
2002-03-11 18:43                                       ` Kevin Cline [this message]
2002-03-11 22:53                                         ` Chad R. Meiners
2002-03-06 17:07                               ` Wes Groleau
2002-03-05  3:45                         ` Brian Rogoff
2002-03-04  1:45                     ` Eric Merritt
2002-03-04  6:03                       ` Hyman Rosen
2002-03-04 13:44                         ` Eric Merritt
2002-03-04 16:01                           ` Hyman Rosen
2002-03-04 18:14                             ` Eric Merritt
2002-03-04 16:46                           ` Jean-Pierre Rosen
2002-03-04 17:08                             ` Hyman Rosen
2002-03-04 18:15                             ` Eric Merritt
2002-03-05 16:54                             ` Pascal Obry
2002-03-05 17:26                               ` Jean-Pierre Rosen
2002-03-04 20:06                     ` Jeffrey Carter
2002-02-27  1:30         ` Adrian Hoe
2002-02-27 20:09         ` Ken Pinard
2002-03-09 20:19         ` Richard Riehle
2001-11-11 20:13 ` Ehud Lamm
2001-11-11 22:32   ` Michal Nowak
2001-11-13 21:43     ` Maciej Sobczak
2001-11-14 16:26       ` Don
2001-11-14 19:32       ` Mark Lundquist
2001-11-14 19:46         ` David C. Hoos
2001-11-15  0:02           ` Mark Lundquist
2001-11-24 23:21           ` Florian Weimer
2001-11-14 21:22         ` Ted Dennison
2001-11-14 21:50       ` Michal Nowak
2001-11-15  7:39         ` Preben Randhol
2001-11-15 14:59           ` Marin David Condic
2001-11-15 15:44             ` Preben Randhol
2001-11-15 16:00         ` John English
  -- strict thread matches above, loose matches on Subject: below --
2002-03-06  6:05 Christoph Grein
2002-03-06  9:24 ` Pascal Obry
2002-03-06 16:43   ` Georg Bauhaus
2002-03-06 15:05 ` Marin David Condic
2002-03-07 13:51   ` Wes Groleau
2002-03-06  7:14 Christoph Grein
2002-03-06  8:43 ` Dmitry A. Kazakov
2002-03-07  7:49 Christoph Grein
2002-03-07 14:06 ` Wes Groleau
2002-03-08  7:24 Christoph Grein
2002-03-08 13:58 ` Georg Bauhaus
2002-03-08 16:08 ` Wes Groleau
2002-03-11 12:39   ` John English
2002-03-08 16:34 ` Jeffrey Carter
2002-03-08 19:41   ` Wes Groleau
2002-03-09  1:21     ` Jeffrey Carter
2002-03-11  5:37 Christoph Grein
2002-03-11 13:28 ` Georg Bauhaus
2002-03-11 12:56 Christoph Grein
replies disabled

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