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

Enhance Code Maintainability: Replace Hardcoded Value #41

Open
arkaprovob opened this issue Oct 17, 2023 · 0 comments
Open

Enhance Code Maintainability: Replace Hardcoded Value #41

arkaprovob opened this issue Oct 17, 2023 · 0 comments
Assignees
Labels

Comments

@arkaprovob
Copy link
Contributor

arkaprovob commented Oct 17, 2023

It's a generic issue please ally it wherever it is applicable, a few examples are given below

Description:
In the existing code, we have a hardcoded value "10" used for retry attempts. To improve code maintainability, we should replace this value read it from a property.
Similarly for the second example use a constant class (do-not create a new if it exists) and read the value from it

Example Code details

class name:

src/main/java/io/spaship/operator/service/k8s/Operator.java

existing code 1

.onFailure()
                .retry()
                .withBackOff(Duration.ofSeconds(1), Duration.ofSeconds(2))
                .atMost(10)

existing code 2

public ConfigMap updateConfigMap(Environment environment, Object syncConfig) {

        var configMapName = "sidecar-config-"

Benefits:

  • Enhanced code maintainability.
  • Improved flexibility in handling retry attempts.

Implementation:

  1. Replace the hardcoded value "10" with property reading .
  2. Replace the hardcoded value "sidecar-config-" with a constant .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants