Code Style Recommendations
Before committing your code (submitting your homework for review), check whether you've covered the following points:
- The code must be formatted (Ctrl+Alt+L).
- Classes must be organized into packages.
- The code may only contain documenting comments.
/** * This program does such and such */ - The code must NOT contain unnecessary package imports.
- The code must NOT contain redundant blank lines.
- Identifier names must follow naming conventions.
- Class fields should be made private.
- Access to class fields is provided through getters and setters.
- Methods and constructors must have access modifiers. If a method is only used by other methods of the same class, declare it as private.
- Within a class, it's recommended to declare static fields and instance fields first, then constructors, getters, and setters, then all other methods.
- Use constants instead of magic numbers.
- It's good practice to override
toString,equals, andhashCodein the classes you create. - To avoid cluttering your code with getters, setters, and standard methods like
toString,equals, andhashCode, you can use Lombok.
Comments