-
Notifications
You must be signed in to change notification settings - Fork 2
Proper CheckStyling
JoelToh404 edited this page Mar 15, 2021
·
2 revisions
CheckStyle is an important skill to have as we want our code to be readable by coders who see it. Having a consistent coding style enables everyone in your team to be able to read code more easily.
Many Companies actually enforce coding styles and we will be following our code style based on Google's Java Coding Style.
For vim users , you can add the line in your ~/.vimrc file. ''' set expandtab set tabstop=2 set shiftwidth=2 set autoindent set smartindent '''
3.White space should separate Java keywords from parenthesis and braces, and be added on both sides of binary operators.
for e.g ''' for(i=0;i<x;i++){ ''' is bad but ''' for (i=0; i<x; i++){ ''' is good
Opening brace have no line break before but line break after. closing brace has a line break before and line break after.
7. There should be a blank line between constructors, methods, nested classes and static initializers. Blank lines can be used between fields to create logical groupings.
public protected private abstract default static final