Skip to content

[안중원] sprint 2 #30

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

Open
wants to merge 3 commits into
base: 안중원
Choose a base branch
from

Conversation

joongwonAn
Copy link

기본 요구사항

File IO를 통한 데이터 영속화

서비스 구현체 분석

  • [ ] JCF*Service 구현체와 File*Service 구현체를 비교하여 공통점과 차이점을 발견해보세요.
    • "비즈니스 로직"과 관련된 코드를 식별해보세요.
    • "저장 로직"과 관련된 코드를 식별해보세요.

레포지토리 설계 및 구현

  • "저장 로직"과 관련된 기능을 도메인 모델 별 인터페이스로 선언하세요.
    • 인터페이스 패키지명: com.sprint.mission.discodeit.repository
    • 인터페이스 네이밍 규칙: [도메인 모델 이름]Repository
  • 다음의 조건을 만족하는 레포지토리 인터페이스의 구현체를 작성하세요.
    • 클래스 패키지명: com.sprint.mission.discodeit.repository.jcf
    • 클래스 네이밍 규칙: JCF[인터페이스 이름]
    • 기존에 구현한 JCF*Service 구현체의 "저장 로직"과 관련된 코드를 참고하여 구현하세요.
  • 다음의 조건을 만족하는 레포지토리 인터페이스의 구현체를 작성하세요.
    • 클래스 패키지명: com.sprint.mission.discodeit.repository.file
    • 클래스 네이밍 규칙: File[인터페이스 이름]
    • 기존에 구현한 File*Service 구현체의 "저장 로직"과 관련된 코드를 참고하여 구현하세요.

심화 요구 사항

관심사 분리를 통한 레이어 간 의존성 주입

  • 다음의 조건을 만족하는 서비스 인터페이스의 구현체를 작성하세요.
    • 클래스 패키지명: com.sprint.mission.discodeit.service.basic
    • 클래스 네이밍 규칙: Basic[인터페이스 이름]
    • 기존에 구현한 서비스 구현체의 "비즈니스 로직"과 관련된 코드를 참고하여 구현하세요.
    • 필요한 Repository 인터페이스를 필드로 선언하고 생성자를 통해 초기화하세요.
    • "저장 로직"은 Repository 인터페이스 필드를 활용하세요. (직접 구현하지 마세요.)
  • [ ] Basic*Service 구현체를 활용하여 테스트해보세요.
    • 코드 템플릿

      public class JavaApplication {
          static User setupUser(UserService userService) {
              User user = userService.create("woody", "[email protected]", "woody1234");
              return user;
          }
      
          static Channel setupChannel(ChannelService channelService) {
              Channel channel = channelService.create(ChannelType.PUBLIC, "공지", "공지 채널입니다.");
              return channel;
          }
      
          static void messageCreateTest(MessageService messageService, Channel channel, User author) {
              Message message = messageService.create("안녕하세요.", channel.getId(), author.getId());
              System.out.println("메시지 생성: " + message.getId());
          }
      
          public static void main(String[] args) {
              // 서비스 초기화
              // TODO Basic*Service 구현체를 초기화하세요.
              UserService userService;
              ChannelService channelService;
              MessageService messageService;
      
              // 셋업
              User user = setupUser(userService);
              Channel channel = setupChannel(channelService);
              // 테스트
              messageCreateTest(messageService, channel, user);
          }
      }
    • JCF*Repository 구현체를 활용하여 테스트해보세요.

    • File*Repository 구현체를 활용하여 테스트해보세요.

  • 이전에 작성했던 코드(JCF*Service 또는 File*Service)와 비교해 어떤 차이가 있는지 정리해보세요.

Copy link
Collaborator

@joonfluence joonfluence left a comment

Choose a reason for hiding this comment

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

전반적으로 FileIO 처리가 안되어있군요! 나중에라도 구현해보시는 걸 추천드립니다!

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.

4 participants