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

[Step1] 모듈 분리 #6

Merged
merged 1 commit into from Aug 23, 2021
Merged

Conversation

malibinYun
Copy link
Member

의존성에 대해서 궁금한 게 있습니다!
app과 data 모듈이 각각 domain을 알고 있고 (의존하고) 이후 4단계에서 app이 data를 모르면, (의존하지 않으면) data의 구현체와 아웃풋은 어디서 사용하는 것인지 헷갈립니다.
app -> domain <- data 의 그래프로 이해하고있는데,
app -> domain -> data 의 그래프여야 data의 아웃풋을 사용할 수 있는게 아닌가 라고 생각했습니다.

의존 한다 라는 말을 제가 잘못 이해하고있는 것일까요?
A가 B에 의존한다 라는 말은 A가 B를 알고있다 라는 의미이고 A의 gradle에 implementation(B)가 존재한다는 의미로 알고있었습니다.

Copy link
Collaborator

@galcyurio galcyurio left a comment

Choose a reason for hiding this comment

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

1단계 고생하셨습니다!
질문 해주신 부분은 코멘트로 남겨두었습니다.

@@ -43,6 +43,8 @@ android {
}

dependencies {
implementation(project(":domain"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

의존성에 대해서 궁금한 게 있습니다!
app과 data 모듈이 각각 domain을 알고 있고 (의존하고) 이후 4단계에서 app이 data를 모르면, (의존하지 않으면) data의 구현체와 아웃풋은 어디서 사용하는 것인지 헷갈립니다.
app -> domain <- data 의 그래프로 이해하고있는데,
app -> domain -> data 의 그래프여야 data의 아웃풋을 사용할 수 있는게 아닌가 라고 생각했습니다.

의존 한다 라는 말을 제가 잘못 이해하고있는 것일까요?
A가 B에 의존한다 라는 말은 A가 B를 알고있다 라는 의미이고 A의 gradle에 implementation(B)가 존재한다는 의미로 알고있었습니다.

말씀해주신 '의존한다'의 의미가 맞습니다.
app -> data -> domain 대로 구현해주시면 됩니다.
1단계에서 app 모듈은 domain 모듈에 의존해야 한다.클래스간의 의존성 + 모듈 간의 의존성으로 봐주시면 됩니다.

  • data 모듈은 domain 모듈에 의존해야 한다.
    • data 모듈의 클래스는 domain 모듈의 클래스에 의존해야 한다.
  • app 모듈은 domain 모듈에 의존해야 한다.
    • app 모듈의 클래스는 domain 모듈의 클래스에 의존해야 한다.

4단계도 처음에는 app 모듈은 data 모듈에 의존하지 않아야 한다.라고 적어놨습니다.
그런데 app 모듈의 build.gradle에서 data 모듈을 의존하지 말라는 뜻으로 해석할 것 같아서 조금 더 명확하게 app 모듈은 data 모듈의 구현체에 의존하지 않아야 한다.로 변경했습니다.

변경하기 전에 보신 것 같네요 😭

Copy link
Member Author

Choose a reason for hiding this comment

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

변경 후의 app 모듈은 data 모듈의 구현체에 의존하지 않아야 한다. 를 변경 전으로 이해했습니다.
구현체에 의존하는 것이나 모듈에 의존하는 것이나 같다고 이해를 했습니다 ㅠㅠ

음 결론은, app 모듈이 data 모듈을 알고는 있지만, data 모듈에 있는 클래스를 직접 생성 한다는 등의 행위를 하지는 않는 다는 의미일까요?
data 모듈의 객체를 app 모듈에서는 사용하는 게 맞다! 라고 이해하면 될까요?

ㅠㅠ 너무 어렵게 생각하고있는 것인지...
data 모듈과 domain 모듈에서 같은걸 구현 하게 됩니다.. data에서는 DataSource를, domain에서는 Repository를 구현해야한다고 생각이 자꾸 드는데, 맞는 방향인지 잘 모르겠습니다.
제가 여전히 domain이 무엇인지 잘 알지 못해서 그런 것 같습니다. 😥

Copy link
Collaborator

Choose a reason for hiding this comment

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

@malibinYun

  • 모듈 간 의존성은 상관없음
  • 즉, app 모듈이 data 모듈에 의존해도 되지만 구현체 클래스는 참조해서는 안됨

헷갈릴 수 있을 것 같아 아래 두 문장 추가하고 힌트에 예시 남겨두었습니다!

Copy link
Member Author

Choose a reason for hiding this comment

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

감사합니다! 더 고민해서 미션 진행해보겠습니다 😄

@galcyurio galcyurio merged commit 447b329 into next-step:malibinyun Aug 23, 2021
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.

None yet

2 participants