Lou Montana/Sandbox – User
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Readd R3vo's additions) |
Lou Montana (talk | contribs) m (Add X39's link for future reference) |
||
Line 12: | Line 12: | ||
=== Make it readable === | === Make it readable === | ||
{{Informative | See [[Code Optimisation#Make it readable|Make it readable]] for the short version!}} | {{Informative | See [[Code Optimisation#Make it readable|Make it readable]] for the short version!}} | ||
* Some general coding tips from [https://www.topcoder.com/blog/coding-best-practices/ here]: standards, line lengths, etc | |||
** Var names | ** Var names | ||
** Format, indentation, no one-line, spacing, line returns | ** Format, indentation, no one-line, spacing, line returns |
Revision as of 19:31, 5 September 2019
Best practices
Make it readable
- Some general coding tips from here: standards, line lengths, etc
- Var names
- Format, indentation, no one-line, spacing, line returns
- Be consistent (space/tab indentation, (camel)casing, K&R style / Allman style indenting)
Make reusable functions
- Don't duplicate, make functions
Variables
- Prefix your public variables and setVariable with your tag
- PRIVATE (or params) your variables
- Use #define SOME_CONST for constant values instead of variables
Code location
- Nothing in init box but local commands for this specific unit - all the init boxes are run client-side on client connection
0 = myCommand
is "useful" only for editor fields that for no apparent reason refuse commands returning a value.
Final words
- Don't steal code and pretend it's yours — be a decent human being.
- Don't try to obfuscate your code: it's considered rude, especially since you learnt from others.
- Have fun!