WikiLuc

Guest connection: login: Guest, password: anonymous

User Tools

Site Tools


dit:cours:prog1_2014-15

This is an old revision of the document!


Introduction aux concepts des langages de programmation (2014-15)

Les projets

La page des projets

Que faire en cas d'absence?

La présence en cours et en TD est obligatoire pour tous les élèves, normaliens et étudiants. C'est une condition de base du parcours R&I.

Si vous devez être ponctuellement absent, mettre un message pour avertir Luc Bougé, Benoît Le Gouis et David Pichardie: cliquez ici.

C'est votre responsabilité de rattraper le contenu des cours et des TD. Si vous avez un devoir à rendre ce jour-là, vous devez rendre le devoir avant. Un devoir rendu après sera pénalisé comme pour un retard.


Cours 11: Allocation dynamique

Vendredi 5 décembre

  • Mémoire physique et mémoire virtuelle
  • Pile et tas, stratégies de gestion du tas
  • New et delete
  • Classes dynamiques: constructeur, destructeur, copie, affectation

Quelques exemples de programmes: gestion du tas, classe dynamique

Documentation C++
  • New: This header describes functions used to manage dynamic storage in C++.
  • Memory elements: This header defines general utilities to manage dynamic memory.
La minute culture: fuites mémoire

In computer science, a memory leak occurs when a computer program incorrectly manages memory allocations. In object-oriented programming, a memory leak may happen when an object is stored in memory but cannot be accessed by the running code. A memory leak has symptoms similar to a number of other problems (see below) and generally can only be diagnosed by a programmer with access to the program. Because they can exhaust available system memory as an application runs, memory leaks are often the cause of or a contributing factor to software aging. Memory leak, Wikipedia

Quelques outils
  • gdb et son interface graphique ddd. Beaucoup de tutoriels sont disponibles: voir par exemple celui de Daniel Hirschkoff, en charge du cours Programmation à l'ENS Lyon.
  • Valgrind, la Rolls des outils d'analyse. Malheureusement très dépendant de la version du système, n'existe souvent pas encore pour les versions les plus récentes.

Cours 10: Pointeurs et STL

Vendredi 21 novembre

  • Généricité et templates
  • STL: Standard Template Library
  • Itérateurs
  • Exceptions
Documentation C++
La minute culture: TOP500

Twice a year, three Top500 lists come out to rank the world's supercomputers by either their overall performance, their ability to parse enormous data sets, or their minimal environmental impact. And last week the Top500, Graph500 and Green500 were released at the SC13 conference in Denver.

For more than 20 years, the Top500 list has used analysis of brute force computing power, the number of floating-point operations each machine could process per second, to determine the rankings for supercomputers. But parsing data and reducing environmental impact are two trends that have led to the Graph500 and Green500 lists.

The Green500 list provides a window into how difficult it is to build a supercomputer that can compete in terms of efficiency and low energy consumption. Only one supercomputer on this year's Green500, the Piz Dainte from the Swiss National Supercomputing Centre, is also ranked in the top 10 of the Top500.

Most Efficient Supercomputers Ranked On Green500 List, Lily Hay Newman, IEEE Spectrum Nov 2013

spectrum.ieee.org_img_500listsforreal-1385153032572.jpg


Cours 9: Héritage et virtualisation

Vendredi 14 novembre

  • Héritage et visibilité
  • Virtualisation
  • Compléments:
    • Éléments statiques, méthodes et attributs
    • operator << et operator >>
    • Constructeurs, opérateurs et destructeurs par défaut
Documentation C++
Bjarne Stroustrup

Le concepteur de C++ est aussi un grand communicant, ce qui a sans doute significativement contribué à la large adoption du langage. Son site personnel déborde d'informations. Vous y trouverez par exemple un grand nombre d'entretiens. Pour un exemple récent, voir Bjarne Stroustrup Discusses C++.

Il maintient une liste des principales questions qui ont été posées à propos de C++. Voir en particulier celles sur l'héritage.

  • Why are member functions not virtual by default?
  • Why don't we have virtual constructors?
  • What is a pure virtual function?
  • Why doesn't C++ have a final keyword?
  • Why doesn't C++ have a universal class Object?
  • Do we really need multiple inheritance?

Plus étonnant, il maintient aussi une liste des grandes applications développées en C++: Geant4, GCC, Google, Microsoft, etc.

Here is a list of systems, applications, and libraries that are completely or mostly written in C++. Naturally, this is not intended to be a complete list. In fact, I couldn't list a 1000th of all major C++ programs if I tried, and this list holds maybe 1000th of the ones I have heard of. It is a list of systems, applications, and libraries that a reader might have some familiarity with, that might give a novice an idea what is being done with C++, or that I simply thought “cool”. Bjarne Stroustrup, Applications


Cours 8: Classes et objects

parasol.tamu.edu_bs_bjarne2.jpg

Vendredi 7 novembre

  • Classes: l'exemple des complexes
  • Membres internes, membres externes, visibilité, fonctions amies
  • Surcharge des opérateurs, opérateurs infixes
  • Le pointeur this
  • Références, passage de paramètre, qualificatif const
  • Compléments
    • Conception modulaire
    • Compilation séparée: make

Le plus important: la documentation C++ en ligne

Les livres de la semaine
  • Votre nouveau livre de chevet: C++ for mathematicians, Ed Scheinerman and published by CRC Press. Le livre de référence du cours. Achat recommandé.
  • La Bible: The C++ programming language, Bjarne Stroustrup. Le livre où se trouvent les réponses à toutes les questions, même celles que vous n'auriez jamais pensé à poser!
  • Pour ceux qui connaissent un peu C++ et qui veulent approfondir les détails: Langage C++: les spécifications du standard ANSI/ISO expliquées, Jacquelin Charbonnel, Dunod. Le livre que j'utilise pour préparer mes cours C++ aux élèves d'informatique

www.stroustrup.com_3rd_front.jpg

The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity to work with was a language called Simula, which as the name implies is a language primarily designed for simulations. The Simula 67 language - which was the variant that Stroustrup worked with - is regarded as the first language to support the object-oriented programming paradigm. Stroustrup found that this paradigm was very useful for software development, however the Simula language was far too slow for practical use.

Shortly thereafter, he began work on “C with Classes”, which as the name implies was meant to be a superset of the C language. His goal was to add object-oriented programming into the C language, which was and still is a language well-respected for its portability without sacrificing speed or low-level functionality. His language included classes, basic inheritance, inlining, default function arguments, and strong type checking in addition to all the features of the C language.

[…] In mid-2011, the new C++ standard (dubbed C++11) was finished. The Boost library project made a considerable impact on the new standard, and some of the new modules were derived directly from the corresponding Boost libraries. Some of the new features included regular expression support (details on regular expressions may be found here), a comprehensive randomization library, a new C++ time library, atomics support, a standard threading library (which up until 2011 both C and C++ were lacking), a new for loop syntax providing functionality similar to foreach loops in certain other languages, the auto keyword, new container classes, better support for unions and array-initialization lists, and variadic templates.

Written by Albatross, History of C++


Cours 7: Premiers pas en C/C++

Vendredi 24 octobre

  • Hello world!
  • Types de base, la classe string
  • Expressions, affectations, structures de contrôle
  • Conteneurs: vector
  • Fonctions, passage de paramètres par valeur
  • Pointeurs, passage de paramètres par adresse explicite
Les livres de la semaine
De la lecture pour cette semaine

Les discours de Turing Award de Thompson et Ritchie en 1983

  • Kenneth Lane Thompson: Reflections on Software Research, un article étonnamment d'actualité, même s'il a été écrit il y a plus de 30 ans.
  • Dennis MacAlistair Ritchie: Reflections on trustring trust. Probablement l'un des premiers articles sur la possibilité de fabrication de virus informatique. Lisez le début, mais essayez de trouver la solution tout seuls!

Cours 6: Ordre supérieur

www.eecs.ucf.edu_leavens_t-shirts_227-342-map-front.jpg

Vendredi 18 octobre

  • Notion de continuation
  • Fonction usuelles
  • Continuations et exceptions
  • Continuations et itérateurs
Les livres de la semaine

mitpress.mit.edu_covers_9780262510875.jpg

Le livre d'Abelson et Sussman a eu un énorme impact sur l'enseignement de la programmation et la popularité de la programmation fonctionnelle en Scheme. Le livre est entièrement disponible en ligne, associé à un site Web qui rassemble une mine d'exercices et de projets passionnants. Voici un article qui explique l'importance de ce livre.

In 2011, to celebrate the 150th anniversary of MIT, the Boston Globe made a list of the most important innovations developed there. They asked me to explain the importance of SICP, and this is what I sent them:

SICP was revolutionary in many different ways. Most importantly, it dramatically raised the bar for the intellectual content of introductory computer science. Before SICP, the first CS course was almost always entirely filled with learning the details of some programming language. SICP is about standing back from the details to learn big-picture ways to think about the programming process. It focused attention on the central idea of abstraction – finding general patterns from specific problems and building software tools that embody each pattern. It made heavy use of the idea of functions as data, an idea that's hard to learn initially, but immensely powerful once learned. (This is the same idea, in a different form, that makes freshman calculus so notoriously hard even for students who've done well in earlier math classes.) It fit into the first CS course three different programming paradigms (functional, object oriented, and declarative), when most other courses didn't even really discuss even one paradigm.

[…] In my experience, relatively few students appreciate how much they're learning in my course while they're in it. But in surveys of all our CS students, it turns out to be among the most popular courses in retrospect, and I regularly get visits and emails from long-gone students to tell me about how they're using in their work ideas that they thought were impractical ivory-tower notions as students. The invention of the MapReduce software for data parallelism at Google, based on functional programming ideas, has helped eliminate that ivory-tower reputation.

Brian Harvey, University of California, Berkeley


Cours 5: Exceptions

tech.amitbasu.org_wp-content_uploads_2012_06_exception2.jpg

10 octobre 2014

  • Notion d'exception
  • Exceptions Caml, harnais try/with
  • Exceptions et itération: break et continue
  • Exceptions et récursion

Références

  • La recherche d'un élément dans un arbre
  • La vidéo de la semaine: The promise, the limits, and the beauty of software, Grady Booch, IBM Fellow. Transcription anglaise disponible. Grady Booch is an IBM Fellow and the author of numerous books on software design and architecture as well as volumes on UML (which he co-developed with Ivar Jacobsen and James Rumbaugh). In 2007, Grady stopped by Yahoo! to meet with Yahoo! software architects and, while here, he gave an open lecture for engineers. This is a version of a lecture originally given to the British Computer Society in honor of Alan Turing.
  • L'article de la semaine: What really happened on Mars? et la réponse de Glenn Reeves, JPL, responsable du logiciel de la mission spatiale Mars Pathfinder en 1997.

Real-World (Out of This World) Story: The Mars Pathfinder mission was widely proclaimed as “flawless” in the early days after its July 4th, 1997 landing on the Martian surface. Successes included its unconventional “landing” – bouncing onto the Martian surface surrounded by airbags, deploying the Sojourner rover, and gathering and transmitting voluminous data back to Earth, including the panoramic pictures that were such a hit on the Web. But a few days into the mission, not long after Pathfinder started gathering meteorological data, the spacecraft began experiencing system resets. The press reported these failures in terms such as “software glitches” and “the computer was trying to do too many things at once”. Read What really happened on Mars? Also, be sure to read this follow-up message from Glenn Reeves of JPL, who led the software team for the Mars Pathfinder spacecraft. Michael B. Jones, Microsoft


Cours 4: Références

9 octobre 2014

  • Notion de référence, égalité, identité
  • Effets de bord
  • Champs modifiables
  • Listes modifiables
  • Arbres modifiables

Références

Language designers are forever searching for the “proper language” for a domain, task, or class of programs, such that everything – such as correctness, optimisations, abstractions, high-level structures, solutions to a problem, etc. – becomes clearer when the language is used. The four Rs capture the key aspects of programming language’s affect on programs, in its ability to improve reading, writing, running, and reasoning.

These are four important areas that we need to consider when designing effective languages. The four Rs are not meant to argue whether a language is “good” or “bad”, or to unilaterally promote one over the other. Instead, the four Rs provide a framework for thinking critically about the effectiveness of languages and language features. Trade-offs between the four Rs have given a broad and beautiful spectrum of programming languages over the last 70 years. I await further languages with excitement and hope that with better languages everything might become clearer.

The four Rs of programming language design, Dominic Orchard


Cours 3: Théorie des catégories, somme et produit

3 octobre 2014

  • Théorie des catégories
  • Produit et somme catégoriques
  • Application aux listes
  • Applications aux arbres

Références

Abstract nonsense, or general abstract nonsense, is a popular term used by mathematicians to describe certain kinds of arguments and concepts in category theory or applications. The term goes back a long way, and even predates the foundation of category theory as a subject itself. Referring to a joint paper with Samuel Eilenberg that introduced the notion of a “category” in 1942, Saunders Mac Lane wrote the subject was 'then called “general abstract nonsense”'.

The term is believed to have been coined by the mathematician Norman Steenrod, himself one of the developers of the categorical point of view. This term is used by practitioners as an indication of mathematical sophistication or coolness rather than as a derogatory designation.

“Logical abstract nonsense is a subfield of general abstract nonsense”, Language Log


Cours 2: Approche par types abstraits: les listes

19 septembre 2013

  • Listes Ocaml
  • Notion de type abstrait: constructeurs, accesseurs, observateurs, combinateurs, notion d'interface de programmation (API)
  • Fonctions classiques: approches concrète et abstraites
  • Itérateurs: map et reduce

Références


Cours 1: Introduction à Caml

cacm.acm.org_system_assets_0000_2966_052010_cacmpg20_robin-milner.large.jpg

12 septembre 2014

  • Historique, grands noms
  • Présentation générale: interprète interactif, synthèse de type, évaluation
  • Types et opérateurs de base: int, float, char, string, bool, synthèse de type
  • Fonctions: définition explicite, lambda-expressions, curryfication, ordre supérieur

Références


Bibliographie

Langages de programmation

Measuring programming language popularity It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of programmer hours, a different one have more lines of code, a third may utilize the most CPU time, and so on. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems; and other languages are regularly used to write many different kinds of applications.

CAML

Scheme

Sémantique

Lambda-calcul

Théorie des catégories

C

C++


Outils, environnements de programmation, etc.

Un environnement de développement recommandé pour OCaml et C++: Geany

Geany is known to run under Linux, FreeBSD, NetBSD, OpenBSD, MacOS X, AIX v5.3, Solaris Express and Windows. More generally, it should run on every platform, which is supported by the GTK libraries. Only the Windows port of Geany is missing some features.

Tous les projets sont corrigés sous Linux Ubuntu. C'est votre responsabilité que de vérifier que tout marche bien dans cet environnement si vous développez autrement.

OCaml

  • Site de référence. Nous utilisons la version 4.
  • Documentation en ligne
  • Mode emacs tuareg. NB: Ce mode est disponible dans de nombreuses distributions.

Pour utiliser ocaml en mode terminal, je recommande l'utilitaire rlwrap qui permet d'éditer les entrées, à la manière du shell. Il est disponible dans de nombreuses distributions. Utilisation: rlwrap | ocaml

C++

Documentation C++ de référence: The C++ Resources Network

Tout le cours est construit sur le compilateur GNU g++ version 4.8 et les outils GNU standard: make, gdb, etc. Nous utiliserons aussi des outils avancés comme valgrind. L'environnement recommandé est Linux Ubuntu, mais vous pouvez tout à fait travailler sur Windows ou Mac.

Un site ressource sur les environnements de développement C++: la page Wikipedia sur les environnements de développement intégré (EDI)

dit/cours/prog1_2014-15.1491404788.txt.gz · Last modified: 2017/04/05 17:06 by 127.0.0.1