comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <bmoore.ada@gmail.com>
Subject: Re: Why .ads as well as .adb?
Date: Thu, 13 Jun 2019 23:12:50 -0700 (PDT)
Date: 2019-06-13T23:12:50-07:00	[thread overview]
Message-ID: <1da5ba01-055a-491a-b30a-cdd733445c85@googlegroups.com> (raw)
In-Reply-To: <fac481df-158b-4cab-b578-3220c9096c74@googlegroups.com>

On Tuesday, June 11, 2019 at 9:29:10 PM UTC+2, John Perry wrote:
> @Shark8, @joakim
> 
> [Shark8 wrote:]
> 
> > > Why would someone hand you the source code? It's more likely they would hand you the output from javadoc, and you'd work with that.

If I am, for example, reviewing someones code, I'd want to be looking directly at the code, not indirectly through some computer generated filter of that code. I would not trust that important details and errors are being omitted in the filtered output. It is the code that needs to be maintained after all. It should be in a form that is readable, and easy to understand. I should not have to run some external tool to be able to make sense of what the programmer has written. I've also seen plenty of cases where computer generated documentation can be a mess to read for complex systems, so I tend to avoid using them altogether.

> So I definitely understand your argument here. On the other hand, what's the challenge in typing this?
> 
>    javadoc nbody.java
> 
> Unless you're handed the source code *on* *paper*, which I find a little hard to believe, that produces a specification of public and protected classes, methods, fields, etc. How is that different from the spec that Brad described?

For code reviews, paper might well be the medium, or it could some online format such as html, or PDF file, etc.

> 
> > (b) You're assuming there is documentation, and that it is some level of quality that makes it usable/readable.
> 
> Brad's Ada example doesn't have much in the way of documentation, either. I doubt it has much more than javadoc would produce. For instance, it doesn't tell me whether I need to supply a command-line argument, as I do in the Java program (which crashes if I don't, and no, it isn't documented there, either).

In my post, I was talking specifically about the NBodySystem class, not the enclosing class that includes the main program test driver. That represents client code that one would write to exercise the NBodySystem class member functions. The reading of command line parameters is part of the main test driver program, not the NBodySystem class.

But doing this exercise highlights another benefit of having separate specs and bodies. When reviewing someones code, one needs to wear multiple hats. Designing a good interface can be as important as the implementation. When I review code where both the spec and implementation are intermixed, as in the Java case, I am trying to wear multiple hats at the same time, and would not as likely have noticed that the type of the return value of the Energy function (double) does not provide any indication on the units. When looking at specs and implementation separately, I can wear a different hat when reviewing each, and looking at the Ada spec, I am more likely to notice that as a client programmer, I cannot use the specs, without understanding the units, so I would raise a comment on the review asking for the type of the return value for Energy be a type name that describes the units. 

Brad

  reply	other threads:[~2019-06-14  6:12 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-02  0:48 Why .ads as well as .adb? John Perry
2019-06-02  5:42 ` J-P. Rosen
2019-06-02  6:39 ` Dmitry A. Kazakov
2019-06-03  7:35   ` Maciej Sobczak
2019-06-03  7:57     ` J-P. Rosen
2019-06-03 19:49       ` Keith Thompson
2019-06-04  8:03       ` Maciej Sobczak
2019-06-03  8:13     ` Dmitry A. Kazakov
2019-06-03 19:51       ` Keith Thompson
2019-06-03 20:18         ` Dmitry A. Kazakov
2019-06-04  8:24       ` Maciej Sobczak
2019-06-04  9:33         ` Dmitry A. Kazakov
2019-06-05  9:04           ` Maciej Sobczak
2019-06-05 12:48             ` Dmitry A. Kazakov
2019-06-05 17:12               ` G. B.
2019-06-05 18:50                 ` Optikos
2019-06-05 22:57                   ` Randy Brukardt
2019-06-04 22:28         ` Randy Brukardt
2019-06-05  8:28           ` Maciej Sobczak
2019-06-05  9:20             ` J-P. Rosen
2019-06-05  9:28               ` Paul Rubin
2019-06-05 10:11                 ` Niklas Holsti
2019-06-05 12:58                   ` Maciej Sobczak
2019-06-05 14:28                     ` Niklas Holsti
2019-06-06  7:34                       ` Maciej Sobczak
2019-06-06 19:51                         ` Keith Thompson
2019-06-06 20:27                           ` J-P. Rosen
2019-06-06 21:12                         ` Randy Brukardt
2019-06-06 21:17                         ` Randy Brukardt
2019-06-06 22:08                           ` Dennis Lee Bieber
2019-06-07  7:59                           ` Maciej Sobczak
2019-06-07 10:42                             ` alby.gamper
2019-06-07 16:59                               ` Dennis Lee Bieber
2019-06-07 14:10                             ` Brad Moore
2019-06-07 23:37                               ` Paul Rubin
2019-06-08  1:16                                 ` Brad Moore
2019-06-08  7:34                                   ` Simon Wright
2019-06-08 17:44                                 ` G.B.
2019-06-08 21:41                                 ` Keith Thompson
2019-06-09  0:40                                   ` Paul Rubin
2019-06-09 18:56                                     ` Keith Thompson
2019-06-09 20:35                                       ` John Perry
2019-06-09 21:15                                         ` Niklas Holsti
2019-06-09 22:37                                           ` John Perry
2019-06-10  9:01                                             ` Simon Wright
2019-06-10 13:15                                               ` Simon Wright
2019-06-10  9:22                                             ` Niklas Holsti
2019-06-09 21:37                                         ` Simon Wright
2019-06-09 22:40                                           ` John Perry
2019-06-10  9:07                                             ` Simon Wright
2019-06-09 21:46                                         ` Niklas Holsti
2019-06-10 17:11                                         ` Dennis Lee Bieber
2019-06-08  4:57                             ` Randy Brukardt
2019-06-08 23:57                               ` Optikos
2019-06-09  0:43                                 ` Paul Rubin
2019-06-10  8:17                               ` Maciej Sobczak
2019-06-10 19:10                                 ` G.B.
2019-06-10 22:07                                 ` Randy Brukardt
2019-06-11  0:32                                   ` Optikos
2019-06-11 15:39                                     ` Brad Moore
2019-06-11 16:14                                       ` John Perry
2019-06-11 16:46                                         ` Shark8
2019-06-11 19:29                                           ` John Perry
2019-06-14  6:12                                             ` Brad Moore [this message]
2019-06-14 21:51                                               ` John Perry
2019-06-14 16:29                                             ` djakoogler
2019-06-11 18:19                                         ` joakimds
2019-06-11 15:49                                   ` Jeffrey R. Carter
2019-06-07  7:36                       ` Niklas Holsti
2019-06-05 22:41                     ` Randy Brukardt
2019-06-06  3:34             ` Keith Thompson
2019-06-06  7:29               ` Maciej Sobczak
2019-06-06 15:30                 ` John Perry
2019-06-06 15:41                 ` Brad Moore
2019-06-06 19:42                 ` Keith Thompson
2019-06-06 16:37               ` Dennis Lee Bieber
2019-06-02  9:59 ` joakimds
2019-06-02 20:14 ` G.B.
2019-06-03 13:37 ` John Perry
2019-06-03 14:50   ` Niklas Holsti
2019-06-03 19:23     ` John Perry
2019-06-03 21:04       ` Niklas Holsti
2019-06-03 18:51   ` Lucretia
2019-06-03 19:32     ` John Perry
2019-06-03 17:00 ` Jeffrey R. Carter
2019-06-03 18:59   ` Lucretia
2019-06-03 19:29   ` John Perry
2019-06-03 20:00     ` Jeffrey R. Carter
replies disabled

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