Coding with conventions, style and standards
Introduction. Code conventions?
- Best practices regarding spans, naming, code hierarchy.
- Conform to the conventions (stay consistent)
- Why coding style matters
- Github CSS styleguide
- Google HTML/CSS Style Guide
There’s a reason the word ‘war’ is included in this section.
“Let me summarize. The purpose of the tab character is for indentation and formatting. Optimal indentation width differs among people. Text editors allow users to set their preferred indentation width. If you use spaces for indentation, you make text editors ignore the preferred indentation width of your audience, readers or users. Hence, using spaces for indentation is considered harmful.”
I don’t remember where I found this quote but at the end of the day, you should use whatever your team has decided for - and you should stick to it.
Tabs or spaces? Personally, I prefer a single tab-width of 2 spaces.
- Why tabs are clearly superior (lea.verou.me)
- Indentation with spaces considered
- Tabs vs spaces for indentation
- Death to the space infidels
- Drupal coding standards
- Wordpress coding standards
- Wordpress CSS coding standards
- jQuery coding standards
- Programming style (wikipedia.org)