Coding Bible
A collection of notes from a trainee front end web developer
1 min readDec 12, 2020
Decalogue
- Simple
- Readable
- Stable
- Compatible
- Fast
Coding Style
Simple
- Fewest lines of code, whilst remaining readable
- Aim for less than 1000 lines of code for projects (tiny status)
- Minimise global and local variables
- Functions for repetitive or self-contained tasks
- Look for elegant solutions
Readable
- 2 space tabs
- Consistent formatting
- Function headings
- Section headings
- No comments; except for headings, url resources and debugging
- Aim for compact code
Stable
- Understand each line of code
- Minimise variables
- Minimise lines of code
- Avoid while loops
- Functions do not use global variables
- No memory leaks
- Test on all platforms
Compatible
- Use vanilla commands and operations
- Avoid 3rd party libraries
- Test on all platforms
- Websites are compatible with internet explorer (where possible)
Fast
- Minimal console output
- Use fast commands and functions
- Avoid loops
- Eliminate repetition
Languages
HTML, CSS, and JavaScript
- Responsive programming for websites
- Separate CSS and JavaScript files for projects
- Combined CSS and JavaScript acceptable for smaller projects
- Lazy load images
- Embed icons as CSS Base64 background images (iconocd.com)
- Place initiate commands at the end of last JavaScript file to ensure all files are loaded