Merge only working code.
If you are unsure, ask.
If you are stuck for over 1 hour, ask (anyone).
If you can prevent a duplicated code or file, do so.
If you can avoid static, do so.
If you can prevent implicit coversions & implicit operators, do so.
If you see a bug -> fix it, or make new Bug task -> throughtfuly describe how to reproduce it.
If you see something in need of improvement -> improve it or make new Improvement task -> throughtfuly describe it.
Know when to use CDNs, your site might be used behind firewall with restricted access to internet.
If there is some hidden hard to understand meaning of variable name or method, do write comments.
Follow the Boy Scout Rule: "Always leave the campground cleaner than you found it." -> "Always check a code in cleaner than when you checked it out."
Name into prefix issue: https://gist.github.com/aeroson/b313b00225db30931b1320d87de61662
See http://www.dofactory.com/reference/csharp-coding-standards Properties in PascalCasing Fields in camelCasing
float.Parse & double.Parse depends on current thread culture, use CultureInfo.InvariantCulture if possible. can cause parsing issues and exceptions on systems with different default culture
Beware of types and their sizes: can't use short to store data that short can't hold.
type | min | max | bits |
---|---|---|---|
short | -32,768 | 32,767 | 16 |
ushort | 0 | 65,535 | 16 |
int | -2,147,483,648 | 2,147,483,647 | 32 |
uint | 0 | 4,294,967,295 | 32 |
long | -9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 | 64 |
ulong | 0 | 18,446,744,073,709,551,615 | 64 |
Encoding issues: UTF8 vs UTF7 vs Windows etc... (Example: DB update script, after every à an „ was inserted due to different encodings)
Similar characters. (Example: I was looking for ,, but it was actually „)
Renaming/adding/removing properties/fields can cause:
- reflection based automapper to cease working
- reflection dependant code to cease working -> Don't use reflection if you don't have to.
If refactoring, take super extra care that you kept original functionality (this causes the greatest number of bugs).
If something is licensed, check for license in server side code and only then do it, optionally check for license in client side JavaScript, the JavaScript might break because server will not do it.
- float can cause pain, know why and where
- numbers divison: the divisor can be 0
XML parsing: test that the code will work if XML file has more values (not just one).
MySql columns, make sure they have default values, in case new row is being inserted without the column
Nullable<>: assume it will have no value
- click all buttons, make sure they work correctly (Save, Cancel) (Cancel resets the form)
- HTML checkboxes don`t send anytihing if unchecked, send their value if checked, value must be nonempty
Run all regexps in https://regex101.com/ understand them, make sure they are correct. example of incorrectly escaped space in regex: var regExp = new RegExp('^[-\s-a-zA-Z0-9]$'); // doesnt work, if we use "s" regexp fails var regExp = new RegExp('^[-\s-a-zA-Z0-9]$'); // the \s is meant to be space, so it should have been \s
Prefixed or sufixed spaces, make sure to Trim().
Overly long or short strings.
Think about (min, one, zero, multiple, max) use case scenarios (concurrent users, files, database entries, phone numbers, addresses, ..)