2021-02-16(Tue)

항목

내용

학습 날짜

2021-02-16(화)

학습 시간

11:00~24:00

학습 범위 및 주제

Websocket, Backbone, Rails

학습 목표

ChatRoom을 구현한다.

동료 학습 방법

eunhkim님과 페어코딩을 진행하였다.

상세 학습 내용

URL 네임 컨벤션에서 -은 bad case에 속한다는 것을 알게되었다. 실제로 PR을 리뷰하면서 느꼈는데 -은 쌍따옴표로 감사주지 않으면 키 값으로 쓰기 되게 애매하다..

https://api.gov.au/standards/national_api_standards/naming-conventions.html#:~:text=%2Fadd-product-,Query%20Parameter%20Names,_%20)%20character%20SHALL%20be%20used character SHALL be used)

어제 구현해둔 기능을 eunhkim님과 합쳤다. CSS, view 구조를 eunhkim님이 잡아주셨고, 나는 API에 정의된 동작들과 예외처리를 1차적으로 구현해뒀다.

이후 함께 버전을 합친 다음 페어프로그래밍으로 챗룸 메세지 채널, API, 렌더링까지 구현했다.

import consumer from "./consumer";

export function ConnectGroupChatChannel(message_collection, room_id) {
  return consumer.subscriptions.create(
    // 하단 해시는 rails에서 받는 키밸류값
    {
      channel: "GroupChatChannel",
      room_id: room_id,
    },
    {
      connected() {
        // Called when the subscription is ready for use on the server
      },

      disconnected() {
        this.unsubscribe();
        // Called when the subscription has been terminated by the server
      },

      received(message) {
        message_collection.add(message);
        message_collection.trigger("scroll");
      },

      speak(current_user_message) {
        current_user_message["room_id"] = room_id;
        this.perform("speak", current_user_message);
      },
    }
  );
}

학습 내용에 대한 개인적인 총평

eunhkim님과 페어프로그래밍을 하면 뭐가 객체 지향적인가, 의존성을 낮추려면 어떻게 해야하는가, 뭐가 더 클린코드인가를 계속 고민하고 얘기 나눌 수 있다. 긍정적인 영향을 한껏 받는게 만족스럽다 :)

다른 모듈의 PR들을 리뷰할게 너무 많다! 리뷰를 거듭하며 다시금 '리뷰하기 쉽게 커밋'해야겠다는 다짐을 하게되었다. 조금 힘들지만 열심히 리뷰하며 같이 성장해야겠다ㅎㅎ

다음 학습 계획

  • Chat Room 구현 완료

Last updated