Programming Tips & Tricks - robbiehume/CS-Notes GitHub Wiki
- Code should be readable, reusable, and maintainable
- Try to limit comments, the code should be simple enough to speak for itself
- Use guard clauses at top of function
- Guard clauses check if a condition is met and terminates if it isn't
- They help you see where the core logic is and doesn't enter into it unnecessarily
- Group conditions together and reduce nesting
- Validate / handle inputs
- Assume that the inputs aren't always going to be correct, and have cases to validate and handle them when they aren't
Freeze UI state in Google Chrome