We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Introduction to Ada for Beginning and Experienced Programmers

00:00

Formal Metadata

Title
Introduction to Ada for Beginning and Experienced Programmers
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
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
An overview of the main features of the Ada language, with special emphasis on those features that make it especially attractive for free software development. Ada is a feature-rich language, but what really makes Ada stand-out is that the features are nicely integrated towards serving the goals of software engineering. If you prefer to spend your time on designing elegant solutions rather than on low-level debugging, if you think that software should not fail, if you like to build programs from readily available components that you can trust, you should really consider Ada.
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
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)
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
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
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
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
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
Computer programmingStatisticsFormal languageGraph (mathematics)Row (database)Type theoryEmbedded systemDomain nameMultiplication signLink (knot theory)Physical systemLevel (video gaming)Electronic program guideXMLComputer animationMeeting/Interview
Link (knot theory)System callWebsiteProcess (computing)Type theoryFormal languageTranslation (relic)Arithmetic meanGodPlanningWave packetComputer programmingMeeting/Interview
Formal grammarComputer programmingCoefficient of determinationRange (statistics)Formal languageType theoryElement (mathematics)Source codeForm (programming)Graphical user interfaceBus (computing)Data structureCovering spaceMeeting/Interview
Point (geometry)Execution unitMultiplication signSocial classView (database)PhysicistNatural numberFormal languageOperator (mathematics)LengthArithmetic meanTask (computing)CausalityType theoryMeeting/Interview
Task (computing)Utility softwarePattern languageFormal languageInformation securityObject (grammar)CodePointer (computer programming)Arithmetic meanMeeting/Interview
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
Standard deviationPoint (geometry)Order (biology)FacebookNumberCodeBasis <Mathematik>Meeting/Interview
Data miningOcean currentPosition operatorNetwork topology1 (number)Meeting/Interview
Structural equation modelingSoftwareFreeware2 (number)Presentation of a groupRobotDirection (geometry)Complex (psychology)Data conversionMeeting/InterviewComputer animation
Transcript: English(auto-generated)
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
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
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
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
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
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
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
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
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
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
compilers and many free resources, components, API, tutorials and many channels to get help
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
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
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
of course Ariane 5 and it was so successful that Ada was kept for Ariane 6 rocket. So
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
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
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
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
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
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
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,
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.
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,
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
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
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,
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
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.
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
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
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
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
together, then you can make very simple things like that or very sophisticated things like this or even this. So the global syntax is
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
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
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
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
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,
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
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
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,
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
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
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
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
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,
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,
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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.
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
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,
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
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
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
menu. Actually, this is a method. Note that I didn't talk about pointers. In Ada, object-oriented programming is
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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.
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
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
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
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
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,
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
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
as Dell. The software must handle everything. Generics are a way to provide reuse. The trouble with strong typing is that if you design
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
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
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
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
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
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
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
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
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
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
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
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
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-
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,
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
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
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
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
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
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,
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,
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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.
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,
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.
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
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
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
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
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
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,
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
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
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
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
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,
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
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
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
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
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,
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,
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
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
that are now handled by the compiler. Believe me, that's very nice. Thank you for your attention.
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
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.
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
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
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
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
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
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++?
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
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.
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
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...
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.
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.
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.
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
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.
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
conversation directly. Ok. Thank you.