Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Quarto Java style guide

Duckson edited this page Apr 15, 2014 · 6 revisions

Project IPSEN1-Quarto

Group 3, Inf1G

General

  • Indentation - Use 4 spaces
  • Line Length - Up to 80 characters

Naming conventions

  • Variables, properties and functions - lowerCamelCase
  • Class and interface names - UpperCamelCase
  • Constants - ALL_UPPER_CASE_WITH_UNDERSCORES
  • Package names - lowercase

Access modifiers

  • Always specify whether a method or property is public/private/protected.
  • Use private properties by default, create getters/setters for them as needed.
  • Favour private properties/methods over protected ones.

Braces

  • Put your opening curly brace on the same line as the expression.
  • For an if-statement with a single statement, braces are not mandatory.

Comments

Use comments only when appropriate. Do not use them when the code you're explaining is obvious. Always strive to write easy to read, self-explanatory code instead.

Committing

  • Do not commit code that doesn't compile.
  • Do not commit code that's commented out. We have source control for that.
  • Please write good commit messages.

Unit testing

Optional: Write unit tests for your code if you're willing and able.

Workflow

Create a branch for every new feature or bug fix you're working on. This is more structured than committing straight to master, prevents merge conflicts, and allows for easy code review through diffs and pull requests. Use all-lower-case-with-dashes for the branch name, with only alphanumeric characters.

Don't forget to perform a git pull (and rebase if needed) before pushing your new branch up to GitHub.

Once you're ready to merge your branch into master, use a non fast-forward merge (git merge --no-ff topic-branch). This ensures a merge commit is created, which can easily be reverted.

Clone this wiki locally