Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten overview "big picture" #479

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ Ada Evolution Highlights
| :ada:`'Image` for all types
| Declare expression

.. note:: Ada was created to be a **compiled**, **multi-paradigm** language with a **static** and **strong** type model

300 changes: 57 additions & 243 deletions courses/fundamentals_of_ada/010_overview/02-big_picture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,286 +8,100 @@ Language Structure (Ada95 and Onward)

* **Required** :dfn:`Core` implementation

- Reference Manual (RM) sections 1 :math:`\rightarrow` 13
- Predefined Language Environment (Annex A)
- Interface to Other Languages (Annex B)
- Obsolescent Features (Annex J)
* Always present in each compiler/run-time

* Optional :dfn:`Specialized Needs Annexes`

- No additional syntax
- Systems Programming (C)
- Real-Time Systems (D)
- Distributed Systems (E)
- Information Systems (F)
- Numerics (G)
- High-Integrity Systems (H)

-------------------------
*Core* Language Content
-------------------------

* Ada is a **compiled**, **multi-paradigm** language
* With a **static** and **strong** type model

.. container:: columns

.. container:: column

* Language-defined types, including string
* User-defined types
* Overloading procedures and functions
* Compile-time visibility control
* Abstract Data Types (ADT)

.. container:: column

* Exceptions
* Generic units
* Dynamic memory management
* Low-level programming
* Object-Oriented Programming (OOP)
* Concurrent programming
* Contract-Based Programming

--------------------------
The Type Model Saves Money
--------------------------

* Shifts fixes and costs to **early phases**


* Cost of an error *during a flight*?

.. image:: relative_cost_to_fix_bugs.jpg
:height: 50%

-------------
Subprograms
-------------

- Syntax differs between *values* and *actions*
- :ada:`function` for a *value*

.. code:: Ada

function Is_Leaf (T : Tree) return Boolean

- :ada:`procedure` for an *action*

.. code:: Ada

procedure Split (T : in out Tree;
Left : out Tree;
Right : out Tree)

* Specification :math:`\neq` Implementation

.. code:: Ada

function Is_Leaf (T : Tree) return Boolean;
function Is_Leaf (T : Tree) return Boolean is
begin
...
end Is_Leaf;

---------------------------
Dynamic Memory Management
---------------------------

* Raw pointers are error-prone
* Ada **access types** abstract facility

- Static memory
- Allocated objects
- Subprograms

* Accesses are **checked**

- Unless unchecked mode is used

* Supports user-defined storage managers

- Storage **pools**

----------
Packages
----------

* Grouping of related entities

- Subsystems like *Fire Control* and *Navigation*
- Common processing like *HMI* and *Operating System*
- Basic language contents (types, subprograms, packages, etc.)
- Interface to Other Languages

* Separation of concerns

- Specification :math:`\neq` Implementation
- Single definition by **designer**
- Multiple use by **users**

* Information hiding

- Compiler-enforced **visibility**
- Powerful **privacy** system

------------
Exceptions
------------

* Dealing with **errors**, **unexpected** events
* Separate error-handling code from logic
* Some flexibility

- Re-raising
- Custom messages

---------------
Generic Units
---------------

.. container:: columns

.. container:: column

* Code Templates

- Subprograms
- Packages

* Parameterization

- Strongly typed
- **Expressive** syntax
* Optional :dfn:`Specialized Needs Annexes`

.. container:: column
* No additional syntax
* May be present or not depending on compiler/run-time

.. image:: generic_template_to_instances.png
- Real-Time Systems
- Distributed Systems
- Numerics
- High-Integrity Systems

-----------------------------
Object-Oriented Programming
Core Language Content (1/3)
-----------------------------

* Inheritance
* Run-time polymorphism
* Dynamic **dispatching**
* Abstract types and subprograms
* **Interface** for multiple inheritance

----------------------------
Contract-Based Programming
----------------------------

* Pre- and post-conditions
* Formalizes specifications
* Types

.. code:: Ada
* Language-defined types, including string
* User-defined types
* Static types keep things consistent
* Strong types enforce constraints

procedure Pop (S : in out Stack) with
Pre => not S.Empty, -- Requirement
Post => not S.Full; -- Guarantee
* Subprograms

* Type invariants
* Syntax differs between *values* and *actions*
* :ada:`function` for *value* and :ada:`procedure` for *action*
* Overloading of names allowed

.. code:: Ada
* Dynamic memory management

type Table is private with Invariant => Sorted (Table); -- Guarantee
* :dfn:`access type` for abstraction of pointers
* Access to static memory, allocated objects, subprograms
* Accesses are **checked** (unless otherwise requested)

--------------------------
Language-Based Concurrency
--------------------------
* Packages

* **Expressive**
* Grouping of related entities
* Separation of concerns
* Information hiding

- Close to problem-space
- Specialized constructs
- **Explicit** interactions

* **Run-time** handling

- Maps to OS primitives
- Several support levels (Ravenscar...)

* **Portable**

- Source code
- People
- OS & Vendors

-----------------------
Low Level Programming
-----------------------

* **Representation** clauses
* Bit-level layouts
* Storage pools definition

- With access safeties

* Foreign language integration

- C
- C++
- Assembly
- etc...
-----------------------------
Core Language Content (2/3)
-----------------------------

* Explicit specifications
* Exceptions

- Expressive
- Efficient
- Reasonably portable
- Abstractions preserved
* Dealing with **errors**, **unexpected** events
* Separate error-handling code from logic

---------------------------------
Standard Language Environment
---------------------------------
* Generic Units

Standardized common API
* Code templates
* Extensive parameterization for customization

.. container:: columns
* Object-Oriented Programming

.. container:: column
* Inheritance
* Run-time polymorphism
* Dynamic **dispatching**

* Types
* Contract-Based Programming

- Integer
- Floating-point
- Fixed-point
- Boolean
- Characters, Strings, Unicode
- etc...
* Pre- and post-conditions on subprograms

* Math
* Formalizes specifications

- Trigonometric
- Complexes
* Type invariants and predicates

* Pseudo-random number generators
* Complex contracts on type definitions

.. container:: column

* I/O

- Text
- Binary (direct / sequential)
- Files
- Streams
-----------------------------
Core Language Content (3/3)
-----------------------------

* Exceptions
* Language-Based Concurrency

- Call-stack
* Explicit interactions
* Run-time handling
* Portable

* **Command-line** arguments
* **Environment** variables
* **Containers**
* Low Level Programming

- Vector
- Map
* Define representation of types
* Storage pools definition
* Foreign language integration

------------------------------
Language Examination Summary
------------------------------

* Unique capabilities
* Three main goals

- **Reliability**, maintainability
Expand Down
10 changes: 10 additions & 0 deletions courses/fundamentals_of_ada/030_basic_types/01-introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,13 @@ Type Model Run-Time Costs
Y := X;
Z := Y; -- no check required

--------------------------
The Type Model Saves Money
--------------------------

* Shifts fixes and costs to **early phases**

* Cost of an error *during a flight*?

.. image:: relative_cost_to_fix_bugs.jpg
:height: 50%
Loading