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
What feature(s) would you like to see in RepoSense
A large number of getter functions have optional return semantics - the return value might be null if the field is uninitialized or not applicable. The problem is often that it's hard to know if a check is necessary without having the client know about the underlying details of the initialization logic.
the scope of the nulls are only within a function, which does not suffer from the same issue of having to reason about the presence of a value.
Java Optionals are a good way to deal with this pattern, by enforcing a client check when a return value may not be present. This has both the effects of minimizing programmer error and helping document the intended nature of function return values. Ideally, return values that are not Optional are guaranteed to be present.
While this problem is not limited to getter functions, this would be a good place to start this refactor, and consider other instances on a case-by-case basis.
The text was updated successfully, but these errors were encountered:
What feature(s) would you like to see in RepoSense
A large number of getter functions have optional return semantics - the return value might be null if the field is uninitialized or not applicable. The problem is often that it's hard to know if a check is necessary without having the client know about the underlying details of the initialization logic.
RepoSense/src/main/java/reposense/model/ConfigRunConfiguration.java
Lines 44 to 67 in bbb2f69
Not all nulls necessarily bad however. In some cases like this:
RepoSense/src/main/java/reposense/model/AuthorConfiguration.java
Lines 165 to 178 in bbb2f69
the scope of the nulls are only within a function, which does not suffer from the same issue of having to reason about the presence of a value.
Java
Optionals
are a good way to deal with this pattern, by enforcing a client check when a return value may not be present. This has both the effects of minimizing programmer error and helping document the intended nature of function return values. Ideally, return values that are notOptional
are guaranteed to be present.While this problem is not limited to getter functions, this would be a good place to start this refactor, and consider other instances on a case-by-case basis.
The text was updated successfully, but these errors were encountered: