4.8 KiB
aliases
aliases | |
---|---|
|
up:: paradigme de programmation #informatique
[!definition] principe de l'extension créative Un paradigme de programmation est un ensemble de concept, mais tout ensemble de concepts ne forme pas un paradigme. Le principe de l'extension créative (creative extension principle) est une façon d'organiser des concepts pour gréer un véritable paradigme de programmation. ^definition
[!cite]- Programming Paradigms for Dummies: What Every Programmer Should Know - Page 16 Concepts are not combined arbitrarily to form paradigms. They can be organized according to the creative extension principle. This principle was first defined by Felleisen [18] and independently rediscovered in [50].
[!note] Notes Le principe de l'extension créative permet d'organiser les concepts pour former réellement un paradigme. ^SVNS3KNFaP4L4LCJZg5383243p8
[!idea] l'extension créative est un méta-paradigme L'extension créative est un paradigme pour créer des paradigmes.
Fonctionnement de l'extension créative
- Apparition d'une modification envahissante
- résoudre un certain problème nécessite des modifications non-locales
- C'est le signe qu'un nouveau concept peut être découvert
- implémentation d'une solution dans le langage lui-même
- la simplicité est conservée / retrouvée (on évite les modifications envahissantes)
[!cite]+ The paradigms of programming - Page 3 After solving a challenging problem, I solve it again from scratch, retracing only the insight of the earlier solution. I repeat this until the solution is as clear and direct as I can hope for. Then I look for a general rule for attacking similar problems, that would have led me to approach the given problem in the most efficient way the first time. Often, such a rule is of permanent value.
[!note] Notes définition originale de l'extension créative ^QWLFQ9JAaWWITR642g5383243p3
[!cite]- Programming Paradigms for Dummies: What Every Programmer Should Know - Page 17 The common theme in these three scenarios (and many others!) is that we need to do pervasive (nonlocal) modifications of the program in order to handle a new concept. If the need for pervasive modifications manifests itself, we can take this as a sign that there is a new concept waiting to be discovered. By adding this concept to the language we no longer need these pervasive modifications and we recover the simplicity of the program.
[!note] Notes Modification envahissante = signe qu'un nouveau concept peut être découvert
ajouter ce concept au langage => éviter les modifications envahissantes => retrouver la simplicité ^6ZNVVQGIaP4L4LCJZg5383243p9
Exemples
[!cite] Programming Paradigms for Dummies: What Every Programmer Should Know - Page 17 If we need to model updatable memory, that is, entities that remember and update their past, then we will have to add two arguments to all function calls relative to that entity. The arguments represent the input and output values of the memory. This is unwieldy and it is also not modular because the memory travels throughout the whole program. All this clumsiness is unnecessary if we add one concept to the language: named state.
[!note] Notes Les états nommés sont une solution efficace pour modéliser la mémoire que l'on peut mettre à jour.
Cela évite d'avoir à ajouter des arguments à toutes les fonctions qui utilisent cet état. ^VAZ8DBMAaP4L4LCJZg5383243p9
[!cite] Programming Paradigms for Dummies: What Every Programmer Should Know - Page 17 If we need to model error detection and correction, in which any function can detect an error at any time and transfer control to an error correction routine, then we need to add error codes to all function outputs and conditionals to test all function calls for returned error codes. All this complexity is unnecessary if we add one concept to the language: exceptions.
[!note] Notes les exceptions sont une solution efficace pour éviter d'avoir à gérer soi-même les codes d'erreurs, leur propagation etc. ^NKKRZRU4aP4L4LCJZg5383243p9