Skip to main content
added 2 characters in body
Source Link
Heslacher
  • 51k
  • 5
  • 83
  • 177
  • Comments should be used to describe why something is done, **WhatWhat is done should be described by the code itself using meaninful names for variables, parameters, methods and classes. If you need a comment to describe what the purpose of a variable is, you have named the variable not that good.

  • you shouldn't shorten variables names, because this will remove readability. Mr.Maintainer still needs to understand the code in 6 months at first glance.

// flag to determine if environment variables are added to system
// properties.
private boolean isEnvPropsSet = false;  

here you need a comment to describe what for the variable is used. So a better name would be areEnvironmentPropertiesSet.

  • for making your code less errorprone you should use braces {} for single if, else statements and also for single statements of loops.
  • Comments should be used to describe why something is done, **What is done should be described by the code itself using meaninful names for variables, parameters, methods and classes. If you need a comment to describe what the purpose of a variable is, you have named the variable not that good.

  • you shouldn't shorten variables names, because this will remove readability. Mr.Maintainer still needs to understand the code in 6 months at first glance.

// flag to determine if environment variables are added to system
// properties.
private boolean isEnvPropsSet = false;  

here you need a comment to describe what for the variable is used. So a better name would be areEnvironmentPropertiesSet.

  • for making your code less errorprone you should use braces {} for single if, else statements and also for single statements of loops.
  • Comments should be used to describe why something is done, What is done should be described by the code itself using meaninful names for variables, parameters, methods and classes. If you need a comment to describe what the purpose of a variable is, you have named the variable not that good.

  • you shouldn't shorten variables names, because this will remove readability. Mr.Maintainer still needs to understand the code in 6 months at first glance.

// flag to determine if environment variables are added to system
// properties.
private boolean isEnvPropsSet = false;  

here you need a comment to describe what for the variable is used. So a better name would be areEnvironmentPropertiesSet.

  • for making your code less errorprone you should use braces {} for single if, else statements and also for single statements of loops.
Source Link
Heslacher
  • 51k
  • 5
  • 83
  • 177

  • Comments should be used to describe why something is done, **What is done should be described by the code itself using meaninful names for variables, parameters, methods and classes. If you need a comment to describe what the purpose of a variable is, you have named the variable not that good.

  • you shouldn't shorten variables names, because this will remove readability. Mr.Maintainer still needs to understand the code in 6 months at first glance.

// flag to determine if environment variables are added to system
// properties.
private boolean isEnvPropsSet = false;  

here you need a comment to describe what for the variable is used. So a better name would be areEnvironmentPropertiesSet.

  • for making your code less errorprone you should use braces {} for single if, else statements and also for single statements of loops.