Introduction to Ada for Beginning and Experienced Programmers
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 287 | |
Author | ||
Contributors | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/57025 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 2022168 / 287
2
4
6
8
12
17
21
23
31
35
37
41
44
45
46
47
50
62
65
66
67
68
71
73
81
84
85
86
90
92
94
100
102
105
111
114
115
116
117
118
121
122
124
127
131
133
135
137
139
140
141
142
145
149
150
156
164
165
167
169
170
171
172
174
176
178
180
183
184
189
190
192
194
198
205
206
207
208
210
218
220
224
225
229
230
232
235
236
238
239
240
242
243
244
245
246
249
250
253
260
262
264
267
273
274
277
282
283
287
00:00
Computer programBasis <Mathematik>AliasingInterface (computing)Regulärer Ausdruck <Textverarbeitung>FreewareGame controllerCompilerStandard deviationGroup actionExpressionVirtual machineConcurrency (computer science)Interface (computing)Point (geometry)Programmer (hardware)Compilation albumMultiplication signAreaRenewal theorySpacetimeObject (grammar)Level (video gaming)PlanningWave packetObject-oriented programmingProof theoryVery-high-bit-rate digital subscriber lineFormal grammarFormal languageWebsiteGoodness of fitProgrammschleifeHierarchyLibrary (computing)Programming languageFile formatContext awarenessParallel portFreewareBlock (periodic table)Computer-assisted translationForcing (mathematics)Insertion lossMereologyLine (geometry)Computer programmingTelecommunicationTask (computing)Exception handlingArithmetic meanProjective planeBarrelled spaceArtificial neural networkDesign by contractComputer animation
04:55
Computer configurationSystem programmingRead-only memoryCompilerPascal's trianglePhysical systemBlock (periodic table)BuildingBlock (periodic table)BuildingFormal languageRadio-frequency identificationMotif (narrative)Computer programmingGoodness of fitCoefficient of determinationOrientation (vector space)MereologyExtension (kinesiology)Group actionDataflowAreaMultiplication signPascal's triangleLevel (video gaming)Error messageCompilerDirection (geometry)Arrow of timeResultantPlug-in (computing)Phase transitionService (economics)State of matterRule of inferenceServer (computing)Point (geometry)Exception handlingPhysical systemNumberFrequencyData storage deviceCuboidPlanningVariable (mathematics)Functional (mathematics)SpeciesProcedural programmingMilitary baseGeneric programmingMappingOnline helpObject-oriented programmingRun time (program lifecycle phase)Pointer (computer programming)Position operatorMobile WebBuffer solutionComputer hardwareSoftwareSoftware engineeringWordNeuroinformatikConcurrency (computer science)
11:03
BuildingLoop (music)Mach's principlePascal's triangleGreen's functionAsynchronous Transfer ModeStreaming mediaPhysical systemLevel (video gaming)Type theoryLevel (video gaming)CompilerStatement (computer science)Flow separationIndependence (probability theory)Matrix (mathematics)Formal languageVirtual machineElement (mathematics)MereologyTwo-dimensional spaceData structureGame controllerCodeCASE <Informatik>Type colorMultiplication signBuildingBranch (computer science)Range (statistics)Mixed realityLoop (music)Variable (mathematics)ImplementationMappingEquivalence relationInterior (topology)Electronic mailing listLink (knot theory)Semiconductor memoryRight angleAxiom of choiceOrder (biology)Internet service providerSoftware bugDampingCore dumpTunisComputer programmingGreatest elementECosView (database)AbstractionDifferent (Kate Ryan album)DemosceneNP-hardMathematicsComputer animation
17:10
Logical constantGreen's functionFunction (mathematics)SineData typeMountain passType theoryGradientLatin squareInfinitySicAerodynamicsSoftware design patternLogic gatePoint (geometry)Instance (computer science)GUI widgetMenu (computing)GUI widgetBlock (periodic table)Division (mathematics)Database transactionOperator (mathematics)SpacetimeComputer programmingMultiplicationImplementationPoint (geometry)PhysicalismDemosceneDirectory serviceMenu (computing)LengthInstance (computer science)Latent heatPerimeter1 (number)Independence (probability theory)Dynamical systemBuildingMereologyReal numberRight angleMultiplication signCompilerTouchscreenEndliche ModelltheorieMetreColor managementGradientGreen's functionGraph coloringWave packetNetwork topologyPointer (computer programming)Link (knot theory)Connectivity (graph theory)Associative propertyFlow separationRange (statistics)Formal languageEquivalence relationPattern languageMixed realityElement (mathematics)Goodness of fitUsabilityIdentity managementLevel (video gaming)Power (physics)Encapsulation (object-oriented programming)Social classArithmetic meanKeyboard shortcutParameter (computer programming)WordNumberStudent's t-testModul <Software>BitLogical constantObject-oriented programmingCoefficientRegular graphMathematicsType theoryAbstractionType colorData typeComputer fileGraph (mathematics)Group actionFundamental theorem of algebraSoftware design patternXML
25:57
Menu (computing)Coordinate systemPosition operatorPoint (geometry)Instance (computer science)WindowInterface (computing)AbstractionService (economics)WritingCodeRead-only memoryException handlingInternet service providerGeneric programmingMenu (computing)CompilerSet (mathematics)Latent heatInheritance (object-oriented programming)CausalityHypermediaMultiplication signSocial class1 (number)Web crawlerWindowGUI widgetProper mapType theoryBuffer overflowInterface (computing)Exception handlingDifferent (Kate Ryan album)Array data structureFormal languageIntegrated development environmentVirtual machineProcedural programmingTwin primeDynamical systemInstance (computer science)Network topologyFamilyOperator (mathematics)Game theoryReading (process)Right angleJava appletService (economics)Game controllerDigital photographyComputer programmingCodeError messageSemiconductor memorySoftwarePhysical systemPositional notationPerimeterOrder (biology)Link (knot theory)Arithmetic meanExpected valueQuantum statePointer (computer programming)Modal logicHierarchyElectric generatorSign (mathematics)Limit (category theory)NumberGeneric programmingAlgorithmEndliche ModelltheorieMathematicsAbstractionParameter (computer programming)Variable (mathematics)ImplementationCategory of beingAssociative propertyData typeRun time (program lifecycle phase)Classical physicsObject (grammar)SatelliteComputer configurationFlow separationBuffer solutionComputer animation
34:43
Generic programmingInternet service providerLibrary (computing)Object (grammar)Thread (computing)Task (computing)Server (computing)Client (computing)Data modelTelecommunicationSynchronizationLevel (video gaming)CompilerBoolean algebraNatural numberCountingRead-only memoryFunction (mathematics)Logical constantPOKECodeInterrupt <Informatik>Domain namePlug-in (computing)Task (computing)SynchronizationInclusion mapFormal languageProcedural programmingConstructor (object-oriented programming)Row (database)MereologyArray data structureView (database)Level (video gaming)Object (grammar)Representation (politics)Library (computing)Semaphore lineCompilerEndliche ModelltheoriePlug-in (computing)Validity (statistics)TelecommunicationDifferent (Kate Ryan album)Multiplication signWordServer (computing)Domain nameComputer hardwareClient (computing)Latent heatProcess (computing)Interrupt <Informatik>Semiconductor memoryTouchscreenAreaPOKEStandard deviationCategory of beingImplementationType theoryDesign by contractPointer (computer programming)State of matterSampling (statistics)BitCountingMachine codeField (computer science)Template (C++)SpeicheradresseGeneric programmingAttribute grammarRange (statistics)Form (programming)Service (economics)Substitute goodFunctional (mathematics)Bridging (networking)Equaliser (mathematics)Term (mathematics)MathematicsFrequencyRight angleBounded variationNumberNetwork topologySpeciesSystem programmingReal-time operating systemNewton's law of universal gravitationCASE <Informatik>Power (physics)Virtual machine4 (number)Presentation of a group2 (number)Component-based software engineeringPhysical systemMixed realityPoint (geometry)Address spaceCapability Maturity ModelGoodness of fitFault-tolerant systemUsabilityData storage deviceComputer animation
43:29
Domain nameLatent heatPlug-in (computing)Physical systemReal numberSystem programmingInformationPortable communications deviceVirtual realityComputer programmingCompilerSuite (music)ImplementationError messageLine (geometry)IntegerMessage passingInterface (computing)Component-based software engineeringUniqueness quantificationServer (computing)Process (computing)Source codePresentation of a groupNear-ringGoodness of fitNumberVirtual machineLine (geometry)Computer programmingResultantError messageCompilation albumCompilerNumeral (linguistics)Closed setLibrary (computing)File archiverArithmetic meanPortable communications deviceKeyboard shortcutFormal languagePoint (geometry)Java appletDifferent (Kate Ryan album)Level (video gaming)Physical systemCondition numberCodeVariable (mathematics)InformationMainframe computerUsabilitySoftware bugDomain nameImplementationConstructor (object-oriented programming)WebsiteBounded variationPointer (computer programming)NeuroinformatikServer (computing)Parameter (computer programming)Mathematical analysisConnectivity (graph theory)Bridging (networking)Information securityValidity (statistics)Web 2.0Multiplication signStandard deviationMixed realityMessage passingReading (process)Frame problemComplete metric spaceProcess (computing)Metropolitan area networkGame controllerInterface (computing)Power (physics)Combinational logicWindowInformation systemsTraffic reportingComputer architectureWordMetreRevision controlSubstitute goodComputer animation
52:16
Computer programmingStatisticsFormal languageGraph (mathematics)Row (database)Type theoryEmbedded systemDomain nameMultiplication signLink (knot theory)Physical systemLevel (video gaming)Electronic program guideXMLComputer animationMeeting/Interview
54:15
Link (knot theory)System callWebsiteProcess (computing)Type theoryFormal languageTranslation (relic)Arithmetic meanGodPlanningWave packetComputer programmingMeeting/Interview
55:38
Formal grammarComputer programmingCoefficient of determinationRange (statistics)Formal languageType theoryElement (mathematics)Source codeForm (programming)Graphical user interfaceBus (computing)Data structureCovering spaceMeeting/Interview
56:52
Point (geometry)Execution unitMultiplication signSocial classView (database)PhysicistNatural numberFormal languageOperator (mathematics)LengthArithmetic meanTask (computing)CausalityType theoryMeeting/Interview
58:05
Task (computing)Utility softwarePattern languageFormal languageInformation securityObject (grammar)CodePointer (computer programming)Arithmetic meanMeeting/Interview
59:25
NeuroinformatikFreewareTerm (mathematics)Domain nameEndliche ModelltheoriePoint (geometry)AbstractionWave packetCodeDifferent (Kate Ryan album)View (database)Arithmetic meanOffice suiteVideo gameFirst-person shooterState of matterSystem callWorkstation <Musikinstrument>Directed graphComputer programmingMeeting/Interview
01:00:55
Standard deviationPoint (geometry)Order (biology)FacebookNumberCodeBasis <Mathematik>Meeting/Interview
01:02:04
Data miningOcean currentPosition operatorNetwork topology1 (number)Meeting/Interview
01:02:54
Structural equation modelingSoftwareFreeware2 (number)Presentation of a groupRobotDirection (geometry)Complex (psychology)Data conversionMeeting/InterviewComputer animation
Transcript: English(auto-generated)
00:07
Welcome everybody. This is the introduction to Ada for all those who want to understand what Ada is about in this world where we have many programming languages. The name of Ada
00:23
comes from Ada Byram who was considered the first programmer in history working on Babbage machine. The first standard came up in 1983. Note that it's about the same time as C++, long after C and just a few years before Python. So for those of you who think
00:50
that Ada is an old language, it's in no way older than many of current languages. It was the first industrial language to offer exceptions, generics, tasking and many higher
01:04
level features. A major improvement was made in 1995 with the introduction of object-oriented programming, protected objects for lower-level inter-task communication, hierarchical libraries
01:23
to better organize projects. Note that Ada was the first standardized object-oriented language about three years before C++. There was another standard in 2005, adding interfaces
01:43
inspired from Cheva and many other improvements. In 2012, Ada went more formal, more oriented towards formal proofs with contracts, higher-level expressions and the history is still going
02:05
on. We are about to issue a 2022 standard that will especially improve in the area of concurrent computations, parallel blocks and parallel loops. Ada is a free language
02:28
which is especially important in the context of this first. What does it mean? It's an international standard. It doesn't belong to any maker or to any company. It is freely
02:44
available and the working groups that control the language are user working groups. This is an extract from the IEGO standard and it says this document may be copied in whole
03:02
or in part, in any form or by any means. The Ada standard is a free standard and considering how expensive standards are, usually that's something very important. You can find the standard in HTML or any format you want and you can read the standard. You have free
03:29
compilers and many free resources, components, API, tutorials and many channels to get help
03:40
from. Here are some good sites and also, of course, the usual community chats that you can find like for any other language. Some examples of people who use Ada, the
04:01
French TGV, the high-speed train and Airbus and the famous A380, a very successful plane if not commercially. This is the French Line 14 of the subway which was very successful
04:21
to the point that it was adopted to renew New York's subway and this is the Rosetta probe which proved, which worked absolutely perfectly after five years in space and also a nice thing like the King Cat luxury boat and I don't have the picture here but
04:46
of course Ariane 5 and it was so successful that Ada was kept for Ariane 6 rocket. So
05:01
we'll see that Ada has many features to make safe computing. So all those systems are systems where failure is not an option. But your own software could not fail either. So having a language that will protect you from many flows like buffer overflows, arithmetic
05:25
problems, illegal pointers and so on is a great help also for everyday programming jobs. The basic idea is that Ada checks a lot at compile time and even design flows
05:44
can, to a certain extent, be checked at compile time. So it's true that when you write something in Ada, the first shot in general does not compile. So the first reaction of people is to say, well, that damn compiler will not accept what I've written
06:04
and then after a while you realize that there was a design error in your program and that saved you a lot of debugging time. So many languages tell you, look at all those
06:21
nice features, all the things that are allowed by my language. But in Ada we tend to say, oh, look at all the things that are forbidden by the language because what's important in the language is all the checks it can perform, that is all the things that it
06:42
can forbid. So here is a picture illustrating the various parts of Ada. The basic idea is the concrete base on which the whole language is based. It is a classical procedural
07:00
language that is with procedure, functions, variables and so on. The syntax is based on Pascal because it was very important to have a readable language and Pascal appeared as the best basis for readability. On top of that you have a very strong typing system,
07:25
but really very strong compared to other languages. We'll talk a lot about that. Then you have a number of features, each serving a particular goal of software engineering.
07:41
Packages are here for modularity, exceptions for runtime safety, generics for EU, tasking for concurrency and also a number of low-level programming features because Ada is used a lot in embedded systems and sometimes you have to handle peripherals,
08:08
hardware and so on, so it's important to have a clean access to the low-level features. All these are used to serve programming methodology. Sometimes you hear people saying
08:25
well what's important is to have a good programming methodology, therefore we don't define what coding language we use. In Ada we take the position that the methodological
08:41
aspect should not be abandoned when you go to coding phase. The language is here to express the methodology and that's why you will find so many design errors with Ada because the concept of the methodology maps directly to Ada concept. Therefore,
09:04
if there is a flaw in your design, it will result in a flaw in a program that will be caught by the compiler. Of course we are now proudly supporting object orientation ever since 1995. Then you have the small doghouses on the side. These are kind
09:26
of extensions, these are optional extra packages used for certain special needs but not for anybody's needs. I'll give you a word about that later.
09:42
All in all, when you first look at it, Ada looks like a very classical language with all the usual features. But when you use it, you will discover that it's more different than it seems in the way you use the language and in the services
10:03
provided by the language. Ada has a building block approach. To understand what this means, let's compare it to Play Mobile against Lego. You know with Play Mobile, you have nice little characters, each designed for a very special
10:28
purpose. So they perfectly fit their purpose, but there is nothing else you can do. If you have the Play Mobile circus, you can play Play Mobile circus and
10:41
nothing else. There is even the small characters are not always compatible from a box to another one. The legal approach is to provide pieces that are of no use by themselves. I mean, if you have just basic blocks like this, there is not much you can do with that. But if you assemble those pieces
11:05
together, then you can make very simple things like that or very sophisticated things like this or even this. So the global syntax is
11:27
derived from Pascal, as I said, with improvement to make it more readable. For example, here we have a for loop. It clearly says that C will scan over all possible values in type color and it's protected. You are not
11:47
allowed to change C inside the loop and C will disappear after the loop. So there is no way to cheat with loop control. You are guaranteed that C will scan over the indicated values and nothing else. You have also
12:06
an example of a while loop that's quite classical. At the bottom, you can see that you can give a name to a loop. And if you give a name to the loop, it must be repeated at the end of the loop. And that's
12:24
very convenient to match the beginning and the end of the loop. So these are examples to show you the effort of readability that has been put into the language. The if statement is very classical
12:40
with several parts possible with else if. A special mention for the case statements, that the equivalent of the switch case of C and C++. You can give ranges for the values, but all the values, knowing the type of the controlling element here,
13:04
I, you know, the compiler knows all the possible values. And the compiler checks that all possible values are given in the various branches here of the case statement, or that there is a when others covering all other cases. That's a
13:24
very useful feature because if you change the type of I and if you forget to handle some new cases that you have added, then the compiler will tell you. You can also express
13:43
not only basic values, but even structure values with what is called an aggregate. So, for example, if you have a two-dimensional matrix, like here, you can express directly the value of a matrix in your code. Or here,
14:03
I have a small example of a linked list. So you see that the variable head, you create a new node, so you allocate memory, whose value is initialized to 10,000 and the next element is another new node with some value
14:24
and next is null. The idea is to be able to describe directly structured data without always getting down to the individual elements. So, what do we call a strong
14:44
typing system? Here, I define a type age, the age of a person, as ranging from 0 to 125, and floors in a building ranging from minus 5 to 50. I can declare
15:04
and use variables of those types, assign values, but I cannot mix them. Even if the values are compatible, since they represent different abstractions, you are not
15:21
allowed to mix them. This might seem very obvious. You've been told for a long, long time that you cannot mix apples and oranges, but Ada is the only language that provides that kind of control for your own types,
15:41
especially for elementary types. The idea is that whenever you define an abstraction, some kind of type resulting from your problem domain, like an age, a floor,
16:00
these are elements from the problem domain. Those types must be mapped into the machine, and the machine only knows about bytes, ints, longs, floats, things like that. All other languages provide you access only to the
16:20
machine level. The int in C or in other languages is just the machine level types. Therefore, you have to do the mapping, the implementation choice, to implement your high level types onto the machine. The new thing in Ada
16:43
is that you describe directly at the level, at problem level, the types that you need, and that the compiler will do the mapping, accessing the most appropriate machine type, and that will provide you immediately independence
17:03
to the implementation. You don't care about the machine because the compiler is doing that mapping. Packages are a fundamental feature of Ada. They allow you to
17:21
group into well-defined modules data types or associate operation to data. For example, this package, the column manager, provides you with a type known color, and that type is marked private. It means, okay, there
17:43
is a type, that type is called color, but it's independent from implementation. You don't tell the user of the package how that type is implemented. Therefore, it's really abstract. You can now have also visible
18:01
type, like density, which is a fixed point type, by the way, so it's a type with regular values ranging from zero to one with a step of one over 256. You can define colors here. These are constant, so
18:21
you know that you have a red, a green, a blue color, but you still don't know how it's implemented. It's independent. And you can provide operation like adding, mixing two colors, or changing the intensity of a color by multiplying it by a certain
18:40
coefficient. Of course, the user does not have access to the concrete implementation, but the compiler needs to know how it's implemented. Therefore, if you define a private type, you will have a private part that will tell to the compiler the truth of the
19:02
type. So here we see that the color is made of three values of type density, and here are the values for the red, green, and blue constants. But that is not usable for the external user. It's private part to the compiler.
19:23
And the operations will be implemented in what is called the body of the package. The user of the package has no access to the body. It's purely implementation. And to tell the truth, you can even use the package even before the body is
19:43
written. Therefore, you have a complete independence between the specification, the abstract specification, and the implementation of your abstract data type. Here is the user of that package. If you want to
20:03
paint something, when you use the color manager, you can define a variable of type color as half blue plus half red. If you want to change the color, you can use a multiplication, but not a division, simply because there is no division
20:23
defined on type color. Of course, you could have defined one, but here I didn't. So if you try to use an inappropriate operation, it would be rejected by the compiler. So abstractions are
20:42
really enforced because you have that clean separation between what the user sees and how it's implemented. Note that when you use the package, you must name it in what is called a WIS clause. Every dependence between modules
21:03
is clearly stated in those WIS clauses, so it's easy to see the graph of dependencies. And therefore, we don't need no dirty MEC file in Ada, because the compiler knows what modules
21:21
depend on what other modules, and when you recompile, the compiler is able to recompile only things that are affected by a change and nothing else. Another interesting feature of the language is
21:42
discriminated type. This is something that has almost no equivalent in other languages. A type can have parameters called discriminants. Here, you see you have discriminants that work a bit like parameters to a data type. Here
22:05
I have a student record, and you have three majors, letters, sciences and technology. And of course, you can grade from 0 to 20. Well, sorry, that's the French grading system with numbers. Everybody has a name, defined as a
22:23
string, and the length of the name is given by the parameter. Everybody has a grade in English or in math, and depending on your major, if you have a major in letters, then you have a grade in Latin. If you have a
22:40
major in sciences, then you will have grades in physics and chemistry, or in technology, you have a grade in drawing. So, you have flexible data structures, and which components, or the size of components, can depend on
23:00
those parameters under these discriminants. The object-oriented model of Ada is quite original. That's a typical use of the building blocks approach I described earlier.
23:23
Packages support encapsulation. In addition, there is a special kind of type called tag type that support dynamic binding. A class in the usual sense is encapsulation
23:40
plus dynamic binding. Therefore, it's built by assembling those pieces. There is no class-reserved word in Ada. A class is a special design pattern where you put a tag type into a package. So, for example,
24:05
here is a classical widget. I call the type instance because that allows me to write it as a widget.instance, which is quite readable, with an operation on the
24:21
instance called paint. Then, if I want to define a menu that inherits from the widget, a menu is a widget, I derive a new type from widget.instance, so I say
24:45
that a menu.instance is a new kind of widget.instance, with some extra elements, and I can keep those extra elements private. You can also have them visible, but in that example they are private. And I can redefine an operation for
25:05
menu. Actually, this is a method. Note that I didn't talk about pointers. In Ada, object-oriented programming is
25:23
absolutely not related to pointers. You can do perfect, good object-oriented programming with pointers. Of course, we also have pointers in Ada for linked lists, data structures, and so on, but it's not required for
25:41
object-oriented programming, which also is a big improvement since having no pointers is much safer in general. In every tag type, define an associated
26:03
type managed by the compiler called the class-wide type. So here I have a hierarchy of widgets, so I have windows and I have a menu, and when you have pop-up menus, crawl-down menus, and so
26:21
on, classical inheritance tree. All those types are called specific types. These are the usual types. Associated to each specific type, there is what is called a class-wide type, so it's automatically generated by the compiler with the name
26:41
of the basic type with tick class behind it. So widget tick class is defined as containing all the values of widgets and all the types that are derived from widgets. A type in Ada
27:01
is a set of values. So the set of values of widget tick class is the set of values of everything which is a widget which is derived of the whole inheritance tree. In a sense, in Ada, we make the difference between the
27:22
widget itself, that the specific type, and the widget family, which is widget tick class. That's quite original and has lots of implications. For example, I can define a procedure to move an
27:40
item, but the same algorithm is applicable to all the kinds of widgets. Therefore, I can have a parameter here of type widget tick class, which means that that procedure can be called with any kind of widget. And I can call
28:01
arrays on that item, change its position, paint it again, and so on. If I define two variables, one which is a pop-up dot instance, another which is a window dot instance, since the values all belong to widget tick
28:22
class, I can call move on either of these. And note that each of these specific types has a different implementation of arrays and paint. Therefore, at run time, the compiler
28:41
will call the appropriate operation considering the real, the specific type of the parameter. So if it's a pop-up, you will call the arrays for pop-up. If it's a window, you will call the arrays for window. That's dynamic linking. Note that
29:04
in starting from IDA205, if you prefer the object dot method notation, you can move the first parameter before the operation roughly the same way as you would do in Python.
29:21
Starting from 205, interfaces have been added that work a lot like Java interfaces. The principle is the same. A type can be derived from
29:41
one full tag type and several interfaces. Interfaces are kind of abstract tag types, but there is a small improvement over Java that can now have no methods. Methods that are defined as doing nothing that
30:00
serve as optional methods, for example. For example, if I define a persistence service, something that can be read or written, then if I want to implement that interface, I must provide a read and a write method.
30:21
Then I can have a persistent window that claims that it is derived, it inherits from window dot instance, of course, and that it implements the services of persistence. IDA has exceptions. Exceptions are
30:44
well, now most people know about exceptions. It was not so common when IDA was first released, but now many languages provide exception. A big difference is that exceptions were built into the language right from
31:00
the start. So everything that can go wrong at runtime will raise an exception. In IDA, we don't say we throw an exception, we say that we raise an exception. The model is more like a trap, if you want. So even
31:21
errors that are caught by the runtime, like accessing outside of an array, buffer overflow, dereferencing an old pointer, or even device malfunctioning or memory violation that can happen almost only in
31:41
imported code, all those things, everything that can happen bad at runtime, will translate into an exception. And every exception can be handled. The mantra is that once you've taken care of the unexpected,
32:04
you must take care of the unexpected unexpected. The nice thing with exception is that you can have one others that allows you to handle even everything that is totally unexpected. For CIF systems, systems
32:22
that have to work 24-7, it's very important to handle, by program, everything that can happen. If you have a probe or a satellite orbiting the earth, you certainly cannot go to it and press control
32:41
as Dell. The software must handle everything. Generics are a way to provide reuse. The trouble with strong typing is that if you design
33:01
an algorithm for a certain type, you cannot reuse it for a different type. So generics are a way to provide algorithms that can be instantiated, used on any data type, provided that the data type features a certain
33:20
number of required properties. So here is an example. If I want to swap two variables, well, apparently, you know the algorithm, and that can be used for every variable. But that's not true, because in EDA, for example, we
33:43
have what is called limited types, and limited types do not have assignments. They are strictly controlled, so every single assignment is not available. So you can swap variables if the type provides
34:01
assignments. So the syntax here tells that you can instantiate that swap generate on every type which is at most private. Private types have assignments, but since it doesn't say
34:22
limited, you cannot instantiate these generic unlimited types. And the compiler will check that the feature you use here are always available for a type that matches the requirements
34:42
expressed here. So that's a big difference, for example, between generics and C++ templates. C++ templates are checked when they are instantiated. Here there is a contract, and if the type you
35:02
provide matches the contract provided by the generic specification, then it will always work, because the contract is checked for the implementation according to the required properties given in the specification. Such a
35:23
generic is instantiated this way with, so here I'm writing simply procedure swap edge is new swap with type edge, which means that the compiler will write for me, according
35:41
to that template, a new procedure where every time the type, the word item appears, it will be replaced by edge. So the instantiation, you can understand it as a kind of macro, but it's a semantic macro, it's not text
36:02
substitution. Tasking is an integral part of the language. It's not an external library. There is syntax that define task. Task is the Ada term for threat. So, and this has
36:23
implication in the language, because it means that every implementation of Ada is required to take care of tasking, and for example all libraries are always reentrant and so on. Tasks are high-level objects. They
36:41
are declared like variables, and you can make arrays of tasks, you can have tasks that are part of records and they are handled like usual objects of the language. I won't have time to go into many details, but
37:00
you have high-level communication and synchronization features. The rendezvous implements a client server model where a client calls services provided by a server task. It's a very high-level concept, and it's quite easy to understand. For some lower-
37:24
level communication needs, you have protected objects that work like passive monitors, and that do not, for simple cases, it avoids requiring very small tasks everywhere. And honestly,
37:45
tasking is very easy to use. It's very easy to add little tasks to display a clock in an area of your screen or things like that. In many languages, tasking is hard to use, and people are reluctant to use it
38:02
because if you have to deal with semaphores or low-level things like that, it's a pain. Here, it's very easy to put small tasks to make your task easier and to use them. And, as
38:26
I mentioned, because Ada is used into many embedded systems, you need to access the low-level. And the principle is to let the compiler do the hardware. We have seen those two
38:41
levels. The same is the same thing when you need to access the low-level. First, you define a high-level view. For example, I have a record that could be some data acquired from a device, with a Boolean telling that
39:02
the device is on, a count of samples taken by the device, and a status that's an array of Boolean, for example, the state of various switches on the front panel or something like that. Then, you will describe the
39:22
low-level. You can have what is called a representation clause that will specify the exact bit-by-bit representation of your data. Here, I'm telling that on is at word zero,
39:40
range of bits zero to zero. So it's at bit zero of word zero. And count is bits one to seven, and status is bits eight to fifteen. So in C, bit fields just specify the size. Here,
40:00
you leave no freedom to the compiler. You have the exact bitwise representation. So the principle is, once you have described what you want at the lower level, you still work at high level. If you want to
40:21
change a bit in your bit array, you write quite normally, mi dot status indexed by three colon equal false. And that will translate into the precise machine instruction that does exactly what you want. So it's always
40:42
the same principle. This time, you let the compiler choose the representation. You impose a certain representation, and the compiler will do the bridge between the high level and the lower level. If you want to
41:04
go really low level, there are many things you can do. For example, here, patching memory is very easy in Ada. But you have to tell what you want to do. You define a model of your memory. Here, for example, a storage array. Well, I take the
41:23
famous 640 KB, and I say that this array is implemented at memory address zero. So it will match directly the memory. And then I can write the peak and poke procedure
41:41
simply as high level constructs. But since I have imposed the actual address, this will match exactly my memory. You can also include machine code. You can handle interrupts. You can do lots of low level stuff with Ada. But you have
42:04
to tell it clearly. You don't divert a function like a pointer to meet that you want to access memory. You have to tell what you are doing and to do what you are telling. That's
42:22
the basic principle. Nothing is hidden. You have to be explicit. A word about those annexes. It's an extension of the standardization process. You understand that you may need many
42:41
different features for various specific domains. And since Ada is a certified compiler with a certified validation suite, if everything was put into the standard, then you would need every
43:01
compiler to implement everything, even if the users don't want it. So it's an extension, but that's an extension only in the form of packages, pragmas or attributes that are special values provided by the compiler. And so this
43:24
provides extra features, but no language changes, that's what I mean, that are intended for specific domains. So there is an annex for system programming, for example. There is one for real-time, one for
43:41
distributed systems, which is very interesting. I made a presentation about the distributed systems annex in a previous FOSDEM, so you can retrieve it from the archive. Information systems, some business systems and that kind of system.
44:00
Numerics with guarantees on the accuracy of computation. I also gave a presentation on that. And safety and security annex for high safety systems. So what else? Ada is
44:23
really a portable language. Really. I mean, all those tools you find with all other languages like Configure, Automate, Conditional Compilation, just compensates for the lack of portability. And
44:41
if you need conditional compilation depending on your target, then it means that even if your program works on a number of different targets, nothing proves that it will work on another architecture.
45:00
Here, because you work at the high level and the compiler bridges to the low level, you don't have to make variations depending on the target. Even the virtual machine concept is really a workaround. It's, you know,
45:21
Java, I heard people claiming that Java is portable. Java is not portable. Java works on only one machine, the Java virtual machine. And you have to emulate that machine on other machines if you want to run it. Because it's so important.
45:42
Being portable means that the program will work on various machines without changing the code. And that's really what Ada has achieved. Well, of course, we also have compilers for virtual machines if you want. But
46:01
here, because there is a validation suite, all compilers implement exactly the same language, they are checked, and they must work the same on every machine. And those high-level constructs re-protect you from the differences. So believe me, I did
46:23
that. Many people experienced that. You can write a program that is 100% the same between Linux, Windows, embedded systems, usual mainframes, and so on, to the point that many programs have
46:40
been developed on mainframes because it was easier to develop there, then moved to embedded targets without any major problems. Ada was designed mainly for ease of reading, because the program is written only once, but
47:02
read much more often than it is written. But it doesn't mean it's wrong. So, there are a number of things that will help you when working programs. First of all, and especially NAT, there are very good error
47:24
messages. I keep telling people, please read the error messages. With other languages, in general, the error messages are not very useful. I mean, you all have seen an error in C,
47:41
syntax error near line 23. What does it mean? What does that compiler cannot tell me if I miss a semicolon or a closing parenthesis? All Ada compilers have very good error messages. This is an example. For example, here I made a spelling error
48:02
in the name of a variable, and the compiler tells me possible misspelling of lines, because it made a substitution, found something that was close enough that would have fit at that place. And it can even fix if
48:20
you are used to equal instead of column equal for assignment, then it would tell you. And sometimes when you see the error messages, you wonder if the compiler is reading your mind. That's really, really advanced. The compiler will protect you from many
48:42
mistakes, and you have to experience that to really believe it. So you will have to say that. And especially strong typing. Strong typing, the way it's done in Ada, protects you from many, many confusions, like inverting parameters
49:01
in subprogram calls, confusing a pointer with a pointed at data, and all of the errors that can take hours of debugging to find just don't pass the first compilation. And as Ada proponents usually say,
49:24
if it compiles, it works. Well, of course, it's a bit exaggerated. You still may have algorithmic errors. But you don't have those stupid coding errors that you encounter in many languages. And so once you get
49:44
used to the language, because of course it needs training, you need to understand how it works, but once you pass the first step, you have that nice feeling that you spend your time on designing, thinking about
50:01
your problem, rather than just chasing stupid bugs because you confused two different variables. You have a number of components and tools that are available. An interesting point is that the standard defines how to
50:23
interface Ada with other languages. And you have even tools to automatically generate bindings to libraries written in other languages. The net result is that all the components you can use with other
50:42
languages are available with Ada. Plus someone that are unique to Ada, for example, AWS, that allows you to put a web server inside your Ada program, AZ, which is a great tool to make a tool, an analysis tool for Ada code,
51:03
and you will find a number of that on good sites that summarize everything that's available. So, to conclude, you could expect me to tell you, oh,
51:23
please use Ada. No, I won't tell you that. You are grown-up people, you are free to use whatever language you want. But I will just tell you, please
51:42
try Ada. Give it a chance. And see what it really means to be able to think at a higher level, think at the level of your problem, and forget all about those nasty implementation details
52:03
that are now handled by the compiler. Believe me, that's very nice. Thank you for your attention.
52:29
Questions and answers, you have more questions. The room where this Q&A is taking place will be opened, and you can come here and ask and
52:40
have a longer discussion if needed with GMPR. So, the first question is regarding the type system, and Pavel asks whether Ada is the only language or probably the most widely used language that has distinguishable
53:01
numeric types. Well, I don't know all the languages that you know, and when you talk about languages, you always can find some other languages doing the same thing. Actually, as far as I know, it's the only language
53:21
where you express the high-level notions. Of course, you can embed types in records and make your own types the way you want, but here it's more the need of expressing directly the numeric types that belong
53:41
to the problem domain that make it quite unique. And as far as I know, I don't know of languages that make it that simple. Of course, everything is possible with any language. Okay, thank you. This question was
54:01
already answered, but I would like to ask it nonetheless. Are there any tools to visualize the packages, links, and graphs and dependencies? Probably, that's what they meant by that. Yes, well, you have many tools. Not in GPS, you have tools that
54:22
can visually display all the links between the dependencies and so on. Thanks to the WISC clauses, it's especially easy to do in ADA, because all dependencies are explicit. Okay, thank you. We have a question
54:41
from Christophe. Do you have training learning sessions planned shortly? I can answer that, and then JMPI probably has an offer to you. We have another introduction to ADA, but that one is more, I would say, technical, less introductory, and assumes
55:00
some programming knowledge. It's going to be given this afternoon by Paul Jaret. And it focuses on, if you come from another language, how do you translate concepts to ADA? And I think that will help you a lot more. We also have another introduction for
55:22
this conference that JMPI will give in half an hour or so. And there are learning resources. But no, for this conference, we do not have anything more than that planned. However, I think JMPI can offer you something else. Well, during that conference, well, I
55:42
don't know the whole program, of course. You can watch it again, I think. Otherwise, you will have me speak. I think, Hernando, you know the program better than I do. Now, if
56:01
you're talking about formal commercial training, of course, IDALOG has a lot to provide with that. Okay. Thank you. One question from Pablo. First of all, I think I
56:20
heard about range or even singular types in the past from other sources. Second, even in C++ or Rust or even in C, you can always wrap the numeric types as a single element of a structure types. Sure, the second form is not so convenient, but still. Would you comment on that? Would you
56:40
say that ADA makes it more accessible or clear? Or what are the pitfalls that other languages have to offer? Well, I haven't answered that because it's partly the same as the previous question. But, yes, you can do anything with any language.
57:01
The question is how easy it is, okay? Here, it's plain arithmetic. You define types, you define operations, and you use them. And the fact that it's bundled into the language pushes people to use it.
57:22
If you can do things, but it's too complicated to do it, people will just not use the feature. Here, it's natural from a physicist's point of view to define units and to have operations between units. And you
57:40
don't have to define classes and methods and a whole lot of complicated things just to make sure that you don't add the time and the length. So, yes, you can do it, but in other languages, but if it's too difficult, too inconvenient, people won't do it. That's all. Okay.
58:04
Thank you. We have a question or maybe a comment on tasks by Aldi, who says, I found that it is very hard to restart the tasks in ADA. I can easily start and stop a task, but after the task has stopped, is there
58:22
a pattern that's recommended or a utility in the ADA language that you would recommend or indicate to use? I don't understand exactly what you mean. I mean, a task, when a task is terminated, it is terminated. It makes
58:41
no sense to restart. You may restart an identical task executing the same code, but it's a different object, right? So, yes, it's very easy to restart tasks. You just declare the task, and it starts. Or you can have
59:01
pointers to a task, and then you create a task with new, and it just restarts. I mean, starting in task dynamically is very easy. Is it the same task or an identical task? Well, it depends on what you want to do. I don't know exactly what you had in
59:22
there. Okay. Another question from Wilber. In your experience in working with ADA, what are the main impediments companies run into, have to overcome, if they are switching to ADA from, let's say, C, C++ or
59:42
something similar? Okay. I would say abstraction. Get away from the computer. In my training session, I always tell people, stop programming. You're ADA or C++?
01:00:00
if you use it correctly, you have great ways of modeling the problem and not thinking in terms of computers, not thinking in terms on how do I use my computer to do so and so, but really thinking in terms of the problem domain and expressing the problem
01:00:24
domain. So it's really a different state of mind. It is more different than what you may think from this point of view because you really have to, as I say, forget computing and just turn into modeling the problem domain. That's the main difference.
01:00:43
Once people have understood that, then they feel very easy because it's so nice to forget about the computers. Ok, thank you. Another question from Aldi. Any free code checker and what
01:01:00
coding standard to use for the ADL language? Any recommendations? Well, as coding standard, there is a document which is quite old now but that from the basis of most coding standard. It was, what the name was, it was the ADAM...
01:01:23
I just forgot the name. But it's the basis for most coding standards. Yes, you have two checkers and AdaLog has one called AdaControl. AdaCore has one called NatCheck and a number of coding companies provide coding checkers for Ada.
01:01:45
That's easy. But, well, you'll find a lot of literature about that. I didn't take any out of the, give you every point out of the top of my hand, but a quick Google search, we'll find you a number of standards, certainly.
01:02:03
Ok, and do you have any recommendation for a code checker? Oh, mine of course. AdaControl is... Well, I'm not in a good position because I have invested interest into that.
01:02:21
But certainly, AdaControl is one of the most sophisticated ones. NatCheck comes, well, used to come bundled with Gnat. It's not provided anymore currently. We can hope it will return but it's not currently. And the
01:02:45
other are not free. AdaControl is free software. It's important to do that. And as far as I know, they can just download it from your website, huh? Yes, yes. It's free software.
01:03:02
Ok. Then we have only 25 seconds left. Once again, I would like to thank you, Jean-Pierre, for your tremendous presentation. And if anybody has more complex questions or questions that did not get answered, the bot should now publish this room and you can join this room and talk to Jean-Pierre directly and have a nicer
01:03:25
conversation directly. Ok. Thank you.