Skip to content

Instantly share code, notes, and snippets.

@HarshKapadia2
Last active May 18, 2020 08:32
Show Gist options
  • Save HarshKapadia2/bd5c5b9517378dbedae8676c157fa138 to your computer and use it in GitHub Desktop.
Save HarshKapadia2/bd5c5b9517378dbedae8676c157fa138 to your computer and use it in GitHub Desktop.
Code review on GitHub.

Code Review

  • Source: Code Review by Gaurav Sen & Yogita

  • Gaurav's notes can be found here.

  • The Java code being discussed can be found here.

  • The Golang code being discussed can be found here.

  • Good qualities of a dev

    • Coding skills
      • Quality of code
    • Problem solving skills
    • Communication skills
  • Qualities

    • Readable code
    • Correctness of code
    • Efficiency
  • Good naming of values.

  • Write comments for 'why' the code is written and not for 'what' code is written.

  • Make code readable. Eg: Use a normal if-else block instead of the ternary op. "Instead of writing clever code, write good code."

  • Give comments in an objective style. Don't use pronouns at all...

  • IO calls are expensive. Caching, batch queries & request collapsing are some ways to reduce time...

    • Request collapsing is shutting down a query asking for the same data (use the concept of Futures)
  • Follow the SRP (single responsibility principle) (one method/function doing one job, ie, pure fns)

  • Use StringBuilder rather than Strings in Java to build queries or append to a string many times.

  • Log errors in the catch block and store them.

  • Move constants to be used throughout project to a file of their own or in a class of just the constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment