900 likes | 1k Views
Shlomo Yona http://yeda.cs.technion.ac.il/~yona/ based on slides by Miki Tebeka. Uncomment Your Code. Only 90 slides!. Relax, it’ll be over faster than you think. I’ve read an article. Yes, at work. Thought it might interest you. It’s about not commenting your code.
E N D
Shlomo Yona http://yeda.cs.technion.ac.il/~yona/ based on slides by Miki Tebeka Uncomment Your Code
“Always write code as if the maintenance programmer were an axe murderer who knows where you live.”Mike Dunn
“If something can be described in the language itself, one should do that, and not just mention it in a comment.”
/* Stores information printed on person badge */typedef struct {…} Badge;
typedef struct { int pid; /* Person ID */ char *name; /* Person full name */} InfoOnBadge;
typedef struct { int personId; char *personFullName;} BadgeInfo;
/* Create new badge information`id’ is the person id*/BadgeInfo *new_bagde_info(int id);
BadgeInfo *new_bagde_info(int person_id) {/* Load from database */Database *db = connect_to_database();…}
BadgeInfo *new_bagde_info(int person_id) { BadgeInfo *badge = NULL; badge = load_from_database(person_id); …}
/* Make a copy of original string */strcpy(new_string, old_string);