⇐ MY QUORA-INDEX QUORA - my answered Questions

QUORA - my answered Questions

Q028: What is the most valuable programming skill right now?

Factoring. Breaking down your problem into smaller parts as long as one or very view lines of code per function remain. you will end with a couple of (well) named functions (methods, procedures, words, name it) which in the end could read like prose. It doesn?t matter which language you use.

If you end with very small functions, each function so small that you almost can?t make errors, you might end in quite reliable programs. Easy to review, debug and test small functions.

This is an important style guide for Smalltalk applications

// This is C-Code

int user_is_for_login(user_t *user) {
	return !(user->is.anonymous || user->is.admin);
}

void user_collect_for_login(void) {
	user_t *u;
	for(u=R->users;u;u=u->next) if(user_is_for_login(u)) push(u);
}
char *strnull(char *t) {return t?t:"";} // avoid 0-pointer exception
int main() {
	// Print all User on stdout
	mount_database(); // R->users become a valid list now

	push(0); // Mark beginning of Stack
	user_collect_for_login();
	user_t *u;
	while(u=pop()) printf("user: %s\n", strnull(u->name));

	return 0;
}