Wednesday, April 18, 2012

Declare local variables as late as possible or at the nearest curly brace they belong?

I am working to set some programming practices standards for my organization.
Doing so i came across the issue "Title of this question"



Some finds it best declaring variables as late as possible and some finds its good
to have them at the top of method starting brace.



Oracle Standard also says to declare them as early as possible.
So do i in favor of declaring them at the closest curly brace they belong.



Concerns are




  1. Code Readability


  2. Performance


  3. Less Error Prone




Any Comments are welcomed.





No comments:

Post a Comment