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

Refator: Remove callback field #842

Closed

Conversation

cheesecrust
Copy link
Collaborator

πŸ”— Related Issue

⌨️ What I did

  • λ‹€λ₯Έ Impl μ—μ„œ κ΅¬ν˜„ν•˜κ³  μžˆλŠ” 방식과 λ™μΌν•˜κ²Œ callback 을 Impl class ν•„λ“œμ—μ„œ μ €μž₯ν•˜κ³  μ“°λŠ” λ°©μ‹μ—μ„œ handleLine()μ‹œμ— μƒμœ„ κ°μ²΄μ—μ„œ κ°€μ Έμ™€μ„œ μΊμŠ€νŒ…μ„ ν•˜λŠ” λ°©μ‹μœΌλ‘œ ν†΅μΌν•˜μ˜€μŠ΅λ‹ˆλ‹€.

@cheesecrust cheesecrust self-assigned this Nov 29, 2024
@oliviarla
Copy link
Collaborator

@jhpark816
가독성 μΈ‘λ©΄μ—μ„œ μ €λŠ” κΈ°μ‘΄ 방식이 더 λ‚˜μ€ 것 κ°™κΈ΄ ν•œλ°, μ–΄λ–»κ²Œ μƒκ°ν•˜μ‹œλ‚˜μš”?

Copy link
Collaborator

@jhpark816 jhpark816 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 μ™„λ£Œ

@@ -94,6 +92,8 @@ public CollectionPipedInsertOperationImpl(String key,
public void handleLine(String line) {
assert getState() == OperationState.READING
: "Read ``" + line + "'' when in " + getState() + " state";
CollectionPipedInsertOperation.Callback cb =
(CollectionPipedInsertOperation.Callback) getCallback();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ§ˆλ¬Έμž…λ‹ˆλ‹€.
νƒ€μž… μΊμŠ€νŒ…μ„ ν•΄μ•Ό ν•˜λ‚˜μš”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ„€ ν˜„μž¬ getCallback() 호좜 μ‹œ OperationCallback νƒ€μž…μ„ λ°˜ν™˜ν•˜κ²Œ λ©λ‹ˆλ‹€.
μ΄λ•Œ handleLine λ©”μ„œλ“œμ—μ„œ OperationCallback을 extend ν•œ CollectionPipedInsertOperation.Callback 의 λ©”μ„œλ“œμΈ gotStatus λ₯Ό μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
λ”°λΌμ„œ νƒ€μž… μΊμŠ€νŒ…μ„ ν•˜μ—¬ 이λ₯Ό 호좜 ν•  수 μžˆλ„λ‘ ν•΄μ•Όν•©λ‹ˆλ‹€.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ³€μˆ˜ νƒ€μž…μ΄ CollectionPipedInsertOperation.Callbackμ΄λ―€λ‘œ, gotStatus() ν˜ΈμΆœν•˜λŠ” 데 λ¬Έμ œκ°€ 없지 μ•Šλ‚˜μš”?

   CollectionPipedInsertOperation.Callback cb = getCallback();

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCallbackμ—μ„œλŠ” OperationCallback νƒ€μž…μ„ λ°˜ν™˜ν•˜λŠ”λ° μ΄λŠ” Callback의 μƒμœ„ νƒ€μž…μ΄κΈ° λ•Œλ¬Έμ— λ‹€μš΄ μΊμŠ€νŒ…μ„ ν•΄μ•Όν•©λ‹ˆλ‹€.
λ”°λΌμ„œ μ»΄νŒŒμΌλŸ¬λŠ” ν•΄λ‹Ή 객체가 μ‹€μ œλ‘œ Callback νƒ€μž…μΈμ§€ μ•Œ 수 μ—†κΈ° λ•Œλ¬Έμ— λͺ…μ‹œμ  ν˜• λ³€ν™˜μ„ 톡해 μΊμŠ€νŒ…μ„ ν•΄μ£Όμ–΄μ•Όν•©λ‹ˆλ‹€.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cheesecrust
μƒμ„±μžμ— μ•„λž˜ μ½”λ“œκ°€ μžˆμŠ΅λ‹ˆλ‹€.

this.cb = (Callback) cb;

그러면, μ•„λž˜ μ½”λ“œλ„ κ°€λŠ₯ν•œκ°€μš”?

CollectionPipedInsertOperation.Callback cb = (Callback) getCallback();

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예 κ°€λŠ₯ν•©λ‹ˆλ‹€λ§Œ μ •ν™•ν•œ νƒ€μž… ν‘œν˜„μ„ μœ„ν•΄μ„œ

CollectionPipedInsertOperation.Callback cb =
            (CollectionPipedInsertOperation.Callback) getCallback();

μœ„ 처럼 ν•˜μ˜€μŠ΅λ‹ˆλ‹€.

@cheesecrust
Copy link
Collaborator Author

@cheesecrust
1번 λ°©μ‹μœΌλ‘œ κ΅¬ν˜„ν•œ 연산을 μ‚΄νŽ΄ λ³΄λ‹ˆ, handleLine() λ©”μ†Œλ“œκ°€ μ—¬λŸ¬λ²ˆ 호좜될 수 μžˆλ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€.
κ·Έ 수만큼 getCallback() ν˜ΈμΆœν•˜λŠ” λΉ„μš©μ„ μ‘°κΈˆμ΄λΌλ„ μ€„μ΄λ €λŠ” λͺ©μ μœΌλ‘œ κ΅¬ν˜„ν•΄ λ‘” κ²ƒμž…λ‹ˆλ‹€.
λ”°λΌμ„œ, 1번 방식도 κ·ΈλŒ€λ‘œ μœ μ§€ν•΄ λ‘λŠ” 걸둜 ν•©μ‹œλ‹€.

https://github.com/jam2in/arcus-works/issues/623#issuecomment-2511333536

@cheesecrust cheesecrust closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants