Normes de programmation

← Les principes · 79 diapositives · flèches ou clic pour avancer

Normes de programmation - Appliquées aux différents domaines - par Nadine Giasson St-Amand
Normes de programmation | S - Terminologie des styles - Styles très utilisés - CamelCase has mixedCase and PascalCase - SCREAMING_SNAKE_CASE - kebab-case = spinal-case = lisp-case = caterpillar-case = hyphenated = dashcase - snake_case = c_style - S - variables_en_programmation_c - fonctions_ancienne_programmation_php - fonctions_dans_plugin_wordpress - ENUM_EN_C_OU_EN_JAVA -…
Domaines d'application - des normes - Norme - O - Normes Objet - Norme - B - Normes de Base de données - Normes des Formats et protocoles - Normes Procédurales (non-objet) - Normes Web - Normes Mobile - Norme - F - Norme - M - Norme - W - Norme - P - Normes de programmation | Domaines - Normes Intégration continue - Norme - I - Normes de Configuration et de projet - Norme - C
The only real difficulties in programming are cache invalidation and naming things . - -- Phil Karlton
“Programs must be written for people to read, and only incidentally for machines to execute.” - -- Harold Abelson, Structure and Interpretation of Computer Programs
Any fool can write code that a computer can understand. Good programmers write code that humans can understand . - -- Martin Fowler
Normes de programmation | Norme P - Synthèse des normes - L'objectif principal de ces normes est de distinguer les différents éléments à la lecture du code. - Les variables commencent par des minuscules et comportent des noms d'objet - Les fonctions commencent par des minuscules et commencent par des verbes à l'infinif (excepté la question booléenne) - Les constantes sont toutes en majuscules…
Normes objet - L'objectif est de distinguer les objets, les classes, les méthodes et les constantes. - class Matrice - { - int SYMBOLE_PAR_DEFAUT = -1; - int ** grille; - int dimension; - void calculerDeterminant(); - } - Matrice matrice = new Matrice(); - int determinant = matrice. calculerDeterminant() ; - NORMES pour les CLASSES - Commencent par une majuscule - Sont au singulier - Les champs…
Normes de programmation | Norme C - Normes C++ - NORMES pour QT Creator - On doit nommer les éléments visuels avant de générer le SLOT - Exploiter les CSS et le MVC pour les vues - NORMES pour Unreal - Vos fonctions commencent en minuscule - Seule les fonctions héritées du framework peuvent avoir une majuscule - Un seul fichier par classe (enforcé) - NORMES pour le C++ - Séparer les classes - Un…
Normes de programmation | Norme J - Normes Java (projet) - NORMES pour les CLASSES - Une seule classe par fichier de code, excepté pour les sous-classes internes - NORMES pour les PAQUETAGES - En minuscules seulement - Sans underscore ni abbréviation - Articulé dans l'ordre suivant: - Nom de domaine inversé - Suivi du département ou équipe - Suivi du nom de projet - Suivi de la couche…
Il faut tous les appliquer. - Java compilers do not enforce these rules, but failing to follow them may result in confusion and erroneous code. For example, widget.expand() and Widget.expand() imply significantly different behaviours: widget.expand() implies an invocation to method expand() in an instance named widget, whereas Widget.expand() implies an invocation to static method expand() in…
Normes de programmation | Norme F - Normes configuration - DOCUMENTATION du programme - On ne commente pas trop le code, il doit être auto-descriptif autant que possible - Les fonctions publiques sont documentées avec les annotations excepté les suivantes: - pas les get/set - pas les fonctions graphiques - La javadoc est générée dans le dossier /doc - Ces normes relèvent de l'implantation et de…
A SQL query goes into a bar, walks up to two tables and asks, " can I join you ?" - -- wpicode.com
Normes de BDD - Norme - B - Le nom des champs des tables correspond à - ceux des champs des modèles, aux libellés des formulaires, et surtout au dossier fonctionnel. - Normes pour les noms des tables Chaque table porte le nom le plus simple possible, au singulier . - Une table de relation many-to-many doit être nommée par combinaison des deux tables. - Normes pour les noms des champs - Les champs…
Normes de programmation | Norme W - Normes web - développement - Les normes du web sont particulièrement importantes à respecter en vu de favoriser l'accessibilité, la portabilité, la rétrocompatibilité, la futurocompatibilité, l'indexabilité. Ceci n'est qu'une synthèse. - Norme - W - Architecture des url & contenus - Il n'y a pas de paramètres techniques - Le nom des pages et répertoire est…
Normes de programmation | Norme W - Normes web - déploiement - Les normes du web sont particulièrement importantes à respecter en vu de favoriser l'accessibilité, la portabilité, la rétrocompatibilité, la futurocompatibilité, l'indexabilité. Ceci n'est qu'une synthèse. - Norme - W - Normes des formulaires - L'attribut for des label correspond au id du champs correspondant - Chaque champs a un id…
Normes de programmation | Norme W - Normes web - enrichi - Les normes du web sont particulièrement importantes à respecter en vu de favoriser l'accessibilité, la portabilité, la rétrocompatibilité, la futurocompatibilité, l'indexabilité. Ceci n'est qu'une synthèse. - Norme - W - Normes pour le JS - Le JQuery n'est pas utilisé, excepté pour les widgets, on travaille en VanillaJS - Classes & objets…
Normes de programmation | Norme W - Normes web - CMS - Les normes du web sont particulièrement importantes à respecter en vu de favoriser l'accessibilité, la portabilité, la rétrocompatibilité, la futurocompatibilité, l'indexabilité. Ceci n'est qu'une synthèse. - Norme - W - Normes pour Drupal - À préciser - Normes pour Joomla - À préciser - Normes pour WordPress - Les fonctions sont en…
Normes de programmation | Norme F - Normes des formats - Norme - F - Format JSON - Les objets javascripts suivent les normes objets - Leur export json est identique à l'objet - Champs en minuscules, sémantiques, complets - Protocole client-serveur - Il est documenté sous la forme d'un scénario de protocole (comme diagramme de séquence) - Format CSV - Champs séparés par des points-virgules -…
Normes de programmation | Norme M - Normes mobile - NORMES pour les ressources Android - Layouts: couche_element.xml - Strings: element_description - Dessin: element_souselement_taille - Id: couche_element_souselement - Dimension: couche_element_souselement_taille - NORMES pour le code Android - Classes débutent par une majuscule - Les Activities sont des Vue ou Page - NORMES pour PhoneGap - Les…
Deliver yesterday, code today, think tomorrow.
Normes de programmation | Norme I - Normes - Intégration continue - FRÉQUENCE des VERSIONNEMENTS - À chaque fin de fonctionnalité - À chaque pause de travail - À chaque modification centrale - De plus en plus souvent au fur et à mesure de l'approche de la date de livraison - NATURE des VERSIONS - Petit commentaire télégraphique descriptif - Avec diff des données (fichier SQL) - On update et…
Code never lies, comments sometimes do. - -- Ron Jeffries - You can't lie to the compiler. -- Andrew Stevenson
Normes de programmation | Norme C - Commentaires - C
If you think good architecture is expensive, try bad architecture. - -- Brian Foote and Joseph Yoder
All problems in computer science can be solved by another level of indirection... Except for the problem of too many layers of indirection. - -- David Wheeler
Normes de programmation | Norme T - Principes Transversaux - Certaines normes sont difficiles à décliner en règles claires et sont plus des philosphies de développement - T - Sémantique - Abstraction - Indexabilité
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. - So far, the Universe is winning. - -- Rick Cook
Normes de programmation | R - Références - R - Excellente référence - manque nommage fonctions - http://home.tamk.fi/~jaalto/course/coding-style/ - Référence détaillée orientée J2EE - https://www.slideshare.net/vvijayaraghava/java-j2ee-coding-conventions-26919754
“Programmers are not to be measured by their ingenuity and their logic but by the completeness of their case analysis.” - -- Alan J. Perlis
PENSEES sur l'ARCHITECTURE
“The perfect kind of architecture decision is the one which never has to be made” - -- Robert C. Martin
PENSEES sur la CONCEPTION
“Some of the best programming is done on paper, really. Putting it into the computer is just a minor detail.” - -- Max Kanat-Alexander, Code Simplicity: The Fundamentals of Software
“Think twice, code once.” - -- Waseem Latif
“Software testing is a sport like hunting, it's bughunting.” ― Amit Kalantri
“Progress is possible only if we train ourselves to think about programs without thinking of them as pieces of executable code. ” - -- Edsger W. Dijkstra
Diapositive 38 du diaporama Normes de programmation
PENSEES sur les PROJETS
Nine people can't make a baby in a month. - -- Fred Brooks, The Mythical Man-Month
The fool wonders, the wise man asks. - -- Benjamin Disraeli
“What kind of programmer is so divorced from reality that she thinks she'll get complex software right the first time?” - -- James Alan Gardner, Ascending
Vision without action is a daydream. Action without vision is a nightmare. proverb from japan
Programming is like sex: one mistake and you have to support it for the rest of your life. - -- Michael Sinz - Programming is an art form that fights back.
Test as you fly, fly as you test. - If you can't measure it, you can't improve it. Lord Kelvin
Release early. Release often. - -- Eric S. Raymond
“Trying to improve software quality by increasing the amount of testing is like trying to lose weight by weighing yourself more often. What you eat before you step onto the scale determines how much you will weigh, and the software-development techniques you use determine how many errors testing will find.” ― Steve McConnell, Code Complete
“Legacy code. The phrase strikes disgust in the hearts of programmers. It conjures images of slogging through a murky swamp of tangled undergrowth with leaches beneath and stinging flies above. It conjures odors of murk, slime, stagnancy, and offal. Although our first joy of programming may have been intense, the misery of dealing with legacy code is often sufficient to extinguish that flame.” ―…
“Code without tests is bad code. It doesn't matter how well written it is; it doesn't matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don't know if our code is getting better or worse.” ― Michael C. Feathers, Working Effectively with Legacy Code
Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. Alan Kay If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. Gerald Weinberg.
Don't code today what you can't debug tomorrow - from this blog's title - http://ariya.blogspot.com/
It's all talk until the code runs. - -- Ward Cunningham - The best way to predict the future is to invent it. — Alan Kay
“The corollary of constant change is ignorance. This is not often talked about: we computer experts barely know what we're doing. We're good at fussing and figuring out. We function well in a sea of unknowns. Our experience has only prepared us to deal with confusion. A programmer who denies this is probably lying, or else is densely unaware of himself.” ― Ellen Ullman, Close to the Machine:…
“Programming your mind with positive thoughts each day will go a long way to keep you from allowing external criticism to derail your dreams.” - -- Ken Poirot
If you want to set off and go develop some grand new thing, you don't need millions of dollars of capitalization. You need enough pizza and Diet Coke to stick in your refrigerator, a cheap PC to work on and the dedication to go through with it. - -- John Carmack
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. - -- Tom Cargill - If it wasn't for the last minute, nothing would get done. —Supposedly from "Murphy's Laws"; see here
Diapositive 57 du diaporama Normes de programmation
Consider the momentous event in architecture when the wall parted and the event became . - -- Louis Kahn
Informatique: alliance d'une science inexacte et d'une activité humaine faillible . - -- Luc Fayard
“Functions that create values are easier to combine in new ways than functions that directly perform side effects” - -- Marijn Haverbeke
“Learning the art of programming, like most other disciplines, consists of first learning the rules and then learning when to break them.” - -- Joshua Bloch, Effective Java Programming Language Guide
If you don't test it, it doesn't work. - I don't care if it works on your machine! We are not shipping your machine! - -- Vidiu Platon (whoever that is)
Good code is its own best documentation. As you're about to add a comment, ask yourself, 'How can I improve the code so that this comment isn't needed?' Improve the code and then document it to make it even clearer. -Steve McConnell
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. — C.A.R. Hoare
You wanted a banana but what you got was a gorilla holding the banana and the entire jungle. - -- Joe Armstrong on object-oriented programming
If the code and the comments disagree, then both are probably wrong. - Norm Schryer - It's OK to figure out murder mysteries, but you shouldn't need to figure out code. You should be able to read it. -- Steve McConnell
"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration." -Dijkstra
Relationship between length and quality If you want me to give you a two-hour presentation, I am ready today. If you want only a five-minute speech, it will take me two weeks to prepare. — Mark Twain The shortest version: If I had more time, I would have written a shorter letter. — Marcus T. Cicero The near-perfectionist's version: You know that I write slowly. This is chiefly because I am never…
Documentation is a love letter that you write to your future self. Damian Conway
To iterate is human, to recurse divine. - -- L. Peter Deutsch - (i.e. ne pas le faire sauf si vous êtes dieu) - To understand recursion, you first need to understand recursion
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - -- Rick Osborne
You can use an eraser on the drafting table or a sledgehammer on the construction site. - -- Frank Lloyd Wright - A few months writing code can save you a few hours in design. -- modifé de A few months in the laboratory can save you a few hours in the library.
Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher. - -- Antoine de Saint-Exupéry, French writer (1900-1944), Terre des Hommes (1939)
How do we convince people that in programming simplicity and clarity—in short: what mathematicians call "elegance"—are not a dispensable luxury, but a crucial matter that decides between success and failure? — Edsger W. Dijkstra - Simplicity is prerequisite for reliability. -- Edsger W. Dijkstra
"The complexity you remove can never fail" -- Burt Rutan on the Ansari X Prize - The art of simplicity is a puzzle of complexity. Doug Horton
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. - -- Donald Knuth, Structured Programming with go to Statements, JACM Computing Surveys, Vol 6, No. 4, Dec. 1974, p.268
“Premature optimization is the root of all evil.” - -- Donald Knuth - “Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always a good practice first to make your code right, and then make it fast.” ― Brian Goetz, Java Concurrency in Practice
“I once generalized from a single data point, and I'll never do that again!” ― Carlos Bueno, The Mature Optimization Handbook
Programmers are optimists by nature, they also have a keen eye for the downside. A hyperactive imagination for disaster scenarios is a professional asset; they have to think through everything that can go wrong in order to practice their craft. -- Scott Rosenberg