humantalk - commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout
TRANSCRIPT
![Page 1: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/1.jpg)
Commentaires, je t’aime… un peu, beaucoup, à la folie, pas du tout
![Page 2: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/2.jpg)
Pas du tout
r = n / 2;while ( abs( r - (n/r) ) > t ) {r = 0.5 * ( r + (n/r) );}System.out.println( "r = " + r );
![Page 3: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/3.jpg)
A la folie !'*************************************************' Name: CopyString'' Purpose: This routine copies a string from the source' string (source) to the target string (target).'' Algorithm: It gets the length of "source" and then copies each' character, one at a time, into "target". It uses' the loop index as an array index into both "source"' and "target" and increments the loop/array index' after each character is copied.'' Inputs: input The string to be copied'' Outputs: output The string to receive the copy of "input"'' Interface Assumptions: None'' Modification History: None'' Author: Dwight K. Coder' Date Created: 10/1/04' Phone: (555) 222-2255' SSN: 111-22-3333' Eye Color: Green' Maiden Name: None' Blood Type: AB-' Mother's Maiden Name: None' Favorite Car: Pontiac Aztek' Personalized License Plate: "Tek-ie"'*************************************************
![Page 4: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/4.jpg)
Ce genre de commentaires// Declare category id for productsconst int prodCategoryId = 1024;
// Create an iterator over productsvector<Product>::iterator iter = products_.begin();
// Iterate through all productsfor ( ; iter != products_.end(); ++iter ){ // Assign categody id to each product iter->AssignCategoryId( prodCategoryId );} // end for
Cela me fait penser à :// Increase i by onei++;
![Page 5: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/5.jpg)
Le « Pourquoi », et non le « Comment »
// Assign categody id to each productconst int prodCategoryId = 1024;vector<Product>::iterator iter = products_.begin();
for ( ; iter != products_.end(); ++iter ){ iter->AssignCategoryId( prodCategoryId );}
![Page 6: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/6.jpg)
Je nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variablesJe nommerais correctement mes variables
const int bookCategoryId = 1024;
void assignCategoryToEachProducts(int categoryId, vector<Product> products){ vector<Product>::iterator productsIterator = products.begin();
for ( ; productsIterator != products.end(); ++productsIterator ){ productsIterator->AssignCategoryId( categoryId );}
}
![Page 7: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/7.jpg)
Voyez un commentaire comme un aveu de faiblesse
Codez toujours en pensant que celui qui maintiendra votre code est un psychopathe qui connait votre adresse
Martin Golding
![Page 8: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/8.jpg)
Imperative vs
Declarative
var numbers = [1,2,3,4,5]var doubled = []
for(var i = 0; i < numbers.length; i++) { var newNumber = numbers[i] * 2 doubled.push(newNumber)}console.log(doubled) //=> [2,4,6,8,10]
var numbers = [1,2,3,4,5] var doubled = numbers.map(function(n) { return n * 2})console.log(doubled) //=> [2,4,6,8,10]
![Page 9: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/9.jpg)
var dogsWithOwners = []var dog, owner
for(var di=0; di < dogs.length; di++) { dog = dogs[di]
for(var oi=0; oi < owners.length; oi++) { owner = owners[oi] if (owner && dog.owner_id == owner.id) { dogsWithOwners.push({ dog: dog, owner: owner }) } }}}
SELECT * from dogsINNER JOIN ownersWHERE dogs.owner_id = owners.id
![Page 10: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/10.jpg)
var data = [{x: 5, y: 10}, {x: 20, y: 5}]
var circles = svg.selectAll('circle') .data(data)
circles.enter().append('circle') .attr('cx', function(d) { return d.x }) .attr('cy', function(d) { return d.y }) .attr('r', 0) .transition().duration(500) .attr('r', 5)
D3.js
![Page 11: HumanTalk - Commentaires, je t'aime un peu, beaucoup, à la folie, pas du tout](https://reader031.vdocuments.mx/reader031/viewer/2022032619/55bed475bb61eb023d8b46be/html5/thumbnails/11.jpg)
Merci
Source : http://latentflip.com/imperative-vs-declarative/
http://www.infoq.com/news/2010/03/To-Comment-or-Not-to-Comment
http://blog.codinghorror.com/coding-without-comments/