Coding Tips – to keep in mind

Some common things that I have learnt through out my coding experience —
  1. Check for Multi-threaded issues – like no instance variables in a service class.
  2. File names should have date and for whom the file is being generated.
  3. Check where the file is being stored and what will happen to it.
  4. If the objects are not string then control the output to the file– like for BigDecimal and Dates. It may be changed to other notations.
  5. Add hard coded strings in properties files or make them as constants
  6. Use StringBuffer instead of string
  7. Use BigDecimal instead of double for more complex math calcs.
  8. For BigDecimal use scale and RoundingMode when dividing or multiplying
  9. If creating a file then either set delete on exit property or create files in temp directory.
  10. Use apache StringUtils and DateUtils for quick string and date formatting.
Please feel free to add to this list and this will help others too. :)