comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <bmoore.ada@gmail.com>
Subject: Re: Why .ads as well as .adb?
Date: Fri, 7 Jun 2019 07:10:11 -0700 (PDT)
Date: 2019-06-07T07:10:11-07:00	[thread overview]
Message-ID: <455333f0-ede4-4833-900a-240a499395ac@googlegroups.com> (raw)
In-Reply-To: <47d02bdc-6b50-43aa-bc5d-bb5b6225f5bd@googlegroups.com>

On Friday, June 7, 2019 at 1:59:26 AM UTC-6, Maciej Sobczak wrote:
> > Of course, you are essentially saying that separate 
> > compilation is unnecessary and all of the source for a program should be in 
> > one giant file
> 
> Of course you are proving now that you did not understand the question posted earlier in this thread.
> 
> 1. There *are* languages that don't use separate spec files. Java and Python are well known examples, representing both compiled and scripted approaches.

I suspect that may be more to do with language limitations than anything else,
where the compiler needs to "see" all the code to generate the executable.
I think the same could be said of C++ templates, where the template header file contains all the code, so that the compiler can generate the executable when that source code is inserted into another source file via an #include preprocessor directive.

I am not a Java expert, but I note that Java didn't have modules until 2017 in Java 9, but by then Java coding styles were already cemented in through years of usage. Ada had compiled modules and separate compilation in the form of packages since the beginning.

Bolting on features to languages after the fact can be an improvement, but it helps a lot if the language was well designed from the start.

I think it is a big mistake of languages that encourage the specification and implementation to be in the same source file, and very surprised to see that anyone would be arguing for that.

The separation of specification and implementation ties into the "separation of concerns" attributed to Dijkstra way back in 1974.

When wanting to make use of a 3rd party package in Ada, I value being able to generally understand how to use that package by looking at the specification without having to look at the implementation. You generally only need to look at the public part of a package specification, as you can rely on anything past that as being implementation details.

Even with C++, one cannot stop reading when you see a private: keyword in a class definition, because there can be many public and private sections in a class. You have to keep reading the class specification until to hit the end of the class specification, in case you missed more public parts.

I think Ada does a better job of getting the programmer to separate specification from implementation.

This can become really valuable when programming in the large. For this reason, I think Python is not a good choice for developing a very large system.

I see it as a nice language for writing smaller programs, scripts, and glue-code, etc.

I suspect that when teaching programming languages, small examples are provided that demonstrate language features, and packages in Ada are often not needed. For example, if one looks at the Ada examples in the Rosetta code website, 

http://www.rosettacode.org 

You will often see examples that do not use packages. So Ada does seem to provide good capabilities write examples in a single file when that is needed.

When you work on a large system however, you quickly learn to appreciate the separation of specification and implementation however. 

> 
> 2. Programs written in those languages do *not* need to be written in one giant file. Actually, Java is frequently criticized (it was even in this thread) for forcing the programmer to use too many (!) files. Even though it does not have separate specs.

Maybe Ada offers a benefit here. In languages like Java, there is a tendency to want to put each class in a separate file. With Ada packages, it can make more sense to organize related types in the same package.

Brad

  parent reply	other threads:[~2019-06-07 14:10 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 [this message]
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
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