8000 GitHub - staleread/java-code-review
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

staleread/java-code-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-code-review

Things to fix in Main.java. Based on Google Java Style Guide

Source file structure

  1. There must be exactly one top level class

Formatting

  1. Use 2-space block indentation
  2. Multiple blank lines are not encouraged (See the end of the section).
  3. Use vertical whitespaces between class methods (and optionally class fields)
  1. Use horizontal whitespaces on both sides of binary operators (e.g. &, >=)
  2. There must be a whitespace between the start of comment // and the comment text. The one is missing on lines 4 and 13.
  3. There must be a whitespace after , on line 8
  4. Only one space between keyword and identifier on line 39

Naming

  1. Class names must be in UpperCamelCase
  2. Non-constant field names must be in lowerCamelCase
  3. Method names must follow lowerCamelCase

Outside of Code Style

  1. Use common prefixes for getters and setters: get*, set* instead of take* or put*
  2. Remove IDE-generated comments (lines 4,5)
  3. Use common "BMI" abbreviation instead of "IMB"
  4. Use meaningful field names so that the comments describing their purpose could be removed
  5. The static method should be called in a static way (HumanIMB.Result() instead of humanIMB.Result())
  6. Use && instead of & to avoid unwanted behaviour
  7. The variable assignments could be replaced with return statements
  8. The Result method need a better name (e.g. getBmiFeedback)
  9. Avoid "magic numbers". Without an IDE (e.g. while reviewing conde on GitHub, the purpose of function arguments is not clear)
  10. Holding imb in static state can lead to unwanted behaviour
  11. Putting BMI calculation (business logic) inside a constructor is not a good practice. A dedicated method should be created
  12. What's the purpose of getters/setters if the fields are marked as public? You'd better make them private
  13. Business logic should not live in setters: it's a side effect

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0