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
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What
기존 코드에서는 서비스 객체들이 여러개의 클래스로 분리되어 있었습니다.
이를 리팩토링하기 전에 왜 해야 하는지, 어떻게 하면 더 변경에 유연한 애플리케이션을 만들 수 있을지 공부해보려고 합니다.
Why
기존 코드의 좋은 점 :
기존 코드의 문제점 :
...Service
하나로 합쳤을 때에도 크게 차이가 나지 않는다....Service
에서 자체적으로 메서드를 분리함으로써 해결할 수 있다....CRUDService
대부분의 메서드들은 별도의 로직 없이 Repository의 메서드 호출 결과를 그대로 반환한다. 즉 메서드 분리의 효용이 거의 없다고 할 수 있다....CRUDService
에는 변경의 이유가 Repository 자체의 제거, 추가 외에는 없기 때문에 변경 가능성이 적고 변경의 여파 또한 적다결론 :
How
Think
더 생각해볼 부분:
서비스를 더 작은 책임으로 분리하는 것은 어떨까? 객체들의 응집도를 높일 수 있는 방법이라고 생각한다.
Beta Was this translation helpful? Give feedback.
All reactions