You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
Describe the technical debt
The technical debt in the given code snippet arises from the use of a public constructor in an abstract inner static class. Typically, an abstract class is not instantiated directly; it's designed to be subclassed. When the constructor of such an abstract class is marked as public, it gives an impression that instances of this class can be created directly, which is misleading and potentially confusing for developers. Additionally, it doesn't adhere to the principle of least privilege, which dictates that code should be given only the minimum privileges it needs to operate.
Proposed solution
To address this technical debt, the visibility of the constructor in the SpeedOrPace class should be changed to protected. By doing so, we ensure that only subclasses of SpeedOrPace can access and invoke this constructor. This change makes the code's intention clearer, and it more accurately reflects the purpose and usage of the abstract class.
The modified constructor will look as follows:
Technical information
Device: Pixel 3 API 26
OS: Android 8.0
The text was updated successfully, but these errors were encountered:
Describe the technical debt
The technical debt in the given code snippet arises from the use of a public constructor in an abstract inner static class. Typically, an abstract class is not instantiated directly; it's designed to be subclassed. When the constructor of such an abstract class is marked as public, it gives an impression that instances of this class can be created directly, which is misleading and potentially confusing for developers. Additionally, it doesn't adhere to the principle of least privilege, which dictates that code should be given only the minimum privileges it needs to operate.
Proposed solution
To address this technical debt, the visibility of the constructor in the SpeedOrPace class should be changed to protected. By doing so, we ensure that only subclasses of SpeedOrPace can access and invoke this constructor. This change makes the code's intention clearer, and it more accurately reflects the purpose and usage of the abstract class.
The modified constructor will look as follows:
Technical information
The text was updated successfully, but these errors were encountered: