Skip to content

Mediator/Middleware pattern #43

@JeGwan

Description

@JeGwan
  • Mediator

  • Concept

    • 컴포넌틀이 서로 직접 소통하기 보다 mediator라는 하나의 중심점을 통해 소통하게 만드는 것
    • Mediator는 모든 요청을 받아 적절한 곳으로 응답을 전달해준다.
    • Before

      before
    • After

      after
  • Implementation

  • Review

    • 다음의 경우에 적용할 수 있다.
    • 컴포넌트에서 그 값의 판정과 처리 로직은 관심사가 아니며, 일원화(때문에 singletone과도 친밀하다고 보여진다)된 곳에서 관리하고, 뿌려줄 때.
    • 채팅방 개념이 적용될 수 있는 어디든.
      • 사람들은 채팅방에 들어가거나 나갈 수 있다.
      • 요청/응답은 모두 채팅방을 거친다.
      • 때문에 socket과도 친밀해보인다.
  • Middleware

  • Concept

    • middleware
    • wiki says
      • The term is most commonly used for software that enables communication and management of data in distributed applications. -> 분산 애플리케이션의 데이터 통신/관리에 쓰이는 소프트웨어
      • An IETF workshop in 2000 defined middleware as "those services found above the transport (i.e. over TCP/IP) layer set of services but below the application environment" (i.e. below application-level APIs). -> TCP/IP 레이어 위에, 애플리케이션 레이어 아래 있는
      • In this more specific sense middleware can be described as the dash ("-") in client-server, or the -to- in peer-to-peer. -> client-server 사의의 dash, peer-to-peer의 -to-
    • 한마디로 Middleware란?
      • 선형 흐름에서 모든 흐름이 통과되고 지나가는 곳
        • linear => request/response cycle
        • middleware => express middleware
      • Examples
        • body parser
        • cors
  • 미들웨어와 미디에이터를 쉽게 정의한다면
    • Middleware : Linear flow 에서는 시작과 끝 사이에서 모든 흐름에 개입할 수 있는 것
    • Mediator :
      모든 길은 로마로 통한다.
      형상은 Graph에서 모든 node와 인접한 node
      소통은 오로지 이 node를 거쳐 이루어짐

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions