Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source code style rule definition #33

Closed
janScheible opened this issue May 28, 2022 · 1 comment
Closed

source code style rule definition #33

janScheible opened this issue May 28, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@janScheible
Copy link
Owner

To have a consistent code base it would be good to define some basic rules.
The code has then to be refactored to adhere to them.

@janScheible janScheible added the enhancement New feature or request label May 28, 2022
janScheible added a commit that referenced this issue May 28, 2022
- all static helper classes are now called *Utils
- all other service-style classes have no static methods anymore and use constructor dependency injection
janScheible added a commit that referenced this issue May 28, 2022
- just some numbers that felt okay enough
janScheible added a commit that referenced this issue Jun 24, 2022
- code was already cycle-free on package level
- fixed 'layering' (no dependencies between a package and any of its (sub-)sub-packages)
-- all test gap analysis related classes are now in analysis package (or a sub-package)
-- created a new top-level package for DebugCoverageResolution
janScheible added a commit that referenced this issue Jun 28, 2022
- restricted number of parameters to CheckStyle default (7)
-- introduced step builders for model classes with too many parameters in the constructors
janScheible added a commit that referenced this issue Jul 4, 2022
- immutable types with collections with defensive copies and usage of Collections.unmodifiableXzy(...)
janScheible added a commit that referenced this issue Jul 10, 2022
- now there are also class members of type Optional<?> (instead of wrapping them on-the-fly in the getter)
- had to add OptionalTypeAdapter because Gson does not!!! support Optional<?> in 2022 (see google/gson#1102)
janScheible added a commit that referenced this issue Jul 22, 2022
- Java source file organization can be partially checked with Checkstyle
-- heavily inspired by the Spring rules
janScheible added a commit that referenced this issue Jul 23, 2022
- usage of checked and unchecked exceptions
janScheible added a commit that referenced this issue Jul 23, 2022
- usage of static and wildcard imports
janScheible added a commit that referenced this issue Jul 24, 2022
- implementation of equals(...), hashCode() and toString()
janScheible added a commit that referenced this issue Jul 25, 2022
- implementation of equals(...), hashCode() and toString()
janScheible added a commit that referenced this issue Jul 29, 2022
- always use this for class fields but never for instance methods
janScheible added a commit that referenced this issue Jul 29, 2022
- local variables and parameters must not use `final` because it adds too much noise
janScheible added a commit that referenced this issue Jul 29, 2022
- usage of forEach with Stream API
@janScheible
Copy link
Owner Author

Code style is documented in Source code style section of README.md now and the source code was adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant