• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comments and explanations - how to do it better?

#4
one thing that has been helping me is to make some of the comments in the form of questions, especially for things wrapped in an if check. that way its not necessary to read the code inside the if to get the general sense of what the method is doing or checking for.

like
Code:
// did the contact form validate?
implied: if it didn't we are going to show the contact form again

Code:
// is there inventory for the product?
implied: if there is no inventory we can't buy this item

Code:
// did the transaction complete?
implied: if it didn't then don't complete the order
Reply


Messages In This Thread
RE: Comments and explanations - how to do it better? - by cartalot - 01-09-2016, 05:00 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.