Principles catalog

Principles are general ideas. They explain why you do things a certain way, that is, they explain patterns. Take the sewing and woodworking pattern "measure twice, cut once." Why do that? Because of the principle "materials are expensive, and shouldn't be wasted." (OK, that's a pretty obvious principle.)

Here are principles on this website.

Title Summary Tags Where referenced
Confirm destructive actions

People make mistakes. If there's a destructive action, like deleting a record, then confirm it with users.

DELETE query
Don't trust user data

Validate and sanitize user data.

Validation Validation library, Log files
Get requirements right

Make sure you know what a program is supposed to do, before you write it.

Making entities
Never store plain text passwords

Store hashes instead.

Security A user table
Plan then zoom

Write a program as a broad plan first, leaving the deets for functions. Then work on the functions separately.

More conditions
Reduce cognitive complexity

Make your program easy to think about. You'll spend less time wrestling with bugs.

More conditions, Editing relationships
Reuse

Reuse your code across programs, using functions and page components.

Page components, Code library, One add/edit page, M:N, Goats, clubs, and comedians, Validation basics, Validation functions
Security by obscurity doesn't work

Keep your code secret, and nobody can hack it, right? Well... it's not that easy.

Security Where to put log files