-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
refactor: Refactoring the Result
Class
#7176
base: 2.x
Are you sure you want to change the base?
Conversation
f198304
to
ccb6634
Compare
ccb6634
to
0c848e9
Compare
|
||
public Result() { | ||
this(SUCCESS.code, SUCCESS.msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An implicit success isn't a great design choice because it doesn't align with the conventional understanding of a zero value. If it needs to represent success, it's better to make it clear in the method name rather than assigning it to a default constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch :)
Done in 3b4370f !
Result<String> res = createGroup(namespace, vGroup, clusterName, unitName); | ||
SingleResult<Void> res = createGroup(namespace, vGroup, clusterName, unitName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the refactorings I made was distinguishing between setting the message of Result as a String
and making the generic type of Result a String
—these are separate concerns.
I understand that there are many instances of this pattern in the code.
I plan to focus on refactoring this part as well.
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #7158
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews