Skip to content

Commit

Permalink
Update Mediator.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenphuc22 committed Jan 18, 2024
1 parent 597b8d7 commit 68e76d7
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions Writerside/topics/Mediator.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,6 @@ classDiagram

Trong đoạn code trên, `ChatServer` đóng vai trò là mediator, quản lý việc gửi tin nhắn giữa các `User`. Các `User` không giao tiếp trực tiếp với nhau mà thông qua `ChatServer`.

## So sánh

So với Observer, Mediator tập trung vào việc điều phối giao tiếp giữa các đối tượng, còn Observer tập trung vào mối quan hệ một-nhiều giữa các đối tượng.

## Kết luận

Mediator Pattern hữu ích để giảm sự phụ thuộc trực tiếp giữa các lớp, dễ dàng mở rộng và thay đổi chương trình. Tuy nhiên cũng cần tránh lạm dụng mediator dẫn tới phức tạp hóa code.

0 comments on commit 68e76d7

Please sign in to comment.