Hi, i want to share with you basic about programming using Ada2012.
What is it Ada ?
Ada is a state-of-the art programming language that development teams worldwide are using for critical software: from microkernels and small-footprint, real-time embedded systems to large-scale enterprise applications, and everything in between
*Why use Ada? *
In short, because you want to write reliable and efficient code, with confidence that it works, and not waste time and effort in the process. Ada is unique among languages in how it helps you detect and eliminate bugs early in the software life cycle, when they are least expensive to correct. And as evidenced by the many successfully fielded applications that need to meet hard time or space constraints, Ada helps you build software that is reliable, safe and secure without sacrificing performance.
At the technical level, Ada has everything you might expect in a modern language:
Extensive compile-time and run-time checks
Full Object Oriented Programming support
Concurrent programming features, including support for multicore
Generic templates
Encapsulation
Hierarchical program composition / programming-in-the-large
for more information about the language visit:
Here is a simple program Hello world
A program in Ada2012 has an extension .adb (stands for ada body)
Let break it down
with Ada.Text_IO is an instruction just like import, include or from in other programming languages. It tells to the compiler to import the package Ada Text Input Output but not use it. And this package contains procedures to display text.
procedure in Ada is a function that return nothing. a procedure declaration always starts with the keyword procedure followed by the name of your choice in my case 'main' after we have is and then close using end plus the name of your choice (main). An instruction in ada always end up with semi colons.
Between procedure and end we have another keyword 'begin'.
Between procedure we have the declarative region. This is the part where you can declare your local variables. Instructions 'use Ada.Text_IO;' set visible package Text_IO.
Between begin and end we can write instructions that need to be executed by the program. In our case we only want to print in the console 'Hello World !'.
To execute our program localy we need to install GNAT compiler provided by AdaCore. This software is available here for windows, Linux and Mac users.
That's it and i hope you enjoyed this short tutorial. Leave your comment down here i will be glad to answer you
Top comments (1)
.adb is a GNAT convention, rather than a rule. The language doesn't specify requirements on file-naming conventions.
I'm all for a bit of Ada advocacy, so thank you. It would be great if you could go further.