Bỏ qua tới nội dungSkip to content

Lộ trình họcLearning path

Giáo trình gồm 5 học phần, mỗi học phần đi từ cơ bản tới nâng cao. Có thể mở bài bất kỳ, nhưng thứ tự được sắp để kiến thức nối tiếp nhau.The curriculum has 5 modules, each ordered from fundamentals to advanced topics. You can open any lesson, but the order is designed so ideas build on each other.

Tiến độ khoá họcCourse progress

0/ 45 bài họclessons0%
Bắt đầu: Start: Singleton

Học phần 1Module 1 · Khởi tạoCreational

Nhóm pattern trả lời câu hỏi: tạo object thế nào cho linh hoạt, không phụ thuộc cứng vào class cụ thể?Patterns that answer: how do we create objects flexibly, without hard-wiring concrete classes?

0/5 hoàn thànhcompleted
  1. 01SingletonTiếp theoUp nextĐảm bảo cả ứng dụng chỉ có đúng một instance và một điểm truy cập chung tới nó.Ensure the whole app has exactly one instance and one shared access point to it.Chưa họcNot started
  2. 02Factory MethodGiao việc tạo object cho một method riêng để lớp con hoặc cấu hình quyết định tạo loại nào.Hand object creation to a dedicated method so subclasses or config decide which type to build.Chưa họcNot started
  3. 03BuilderLắp ráp object phức tạp từng bước, đặt tên rõ ràng cho từng tham số, chỉ khai báo những gì khác mặc định.Assemble a complex object step by step, naming each parameter and setting only what differs from defaults.Chưa họcNot started
  4. 04Abstract FactoryMột factory tạo ra cả một họ object đi cùng nhau, đảm bảo chúng luôn 'cùng bộ' với nhau.One factory creates a whole family of related objects, guaranteeing they always match each other.Chưa họcNot started
  5. 05PrototypeTạo object mới bằng cách sao chép một object mẫu đã cấu hình sẵn, rồi chỉ sửa phần khác biệt.Create new objects by copying a pre-configured sample object, then changing only what differs.Chưa họcNot started

Học phần 2Module 2 · Cấu trúcStructural

Nhóm pattern về cách ghép class/object thành cấu trúc lớn hơn mà vẫn gọn, dễ thay đổi.Patterns about assembling classes and objects into larger structures that stay lean and flexible.

0/7 hoàn thànhcompleted
  1. 06AdapterBọc một interface 'lạ' (SDK bên thứ ba, code cũ) để nó khớp với interface mà code của bạn mong đợi.Wrap a 'foreign' interface (third-party SDK, legacy code) so it fits the interface your code expects.Chưa họcNot started
  2. 07DecoratorBọc object trong các lớp vỏ cùng interface để thêm hành vi (cache, log, transaction...) mà không sửa object gốc.Wrap an object in layers sharing its interface to add behaviour (cache, logging, transactions...) without changing it.Chưa họcNot started
  3. 08FacadeMột cửa trước đơn giản che đi cả mớ subsystem phức tạp phía sau.One simple front door that hides a tangle of subsystems behind it.Chưa họcNot started
  4. 09ProxyMột object đứng thế chỗ object thật, cùng interface, để kiểm soát mọi lời gọi tới nó.A stand-in with the same interface as the real object, controlling every call to it.Chưa họcNot started
  5. 10CompositeXếp object thành cây và đối xử với một phần tử lẻ hay cả nhóm theo cùng một cách.Arrange objects into trees and treat a single item and a whole group the same way.Chưa họcNot started
  6. 11BridgeTách 'cái gì' khỏi 'làm bằng cách nào' thành hai nhánh độc lập, nối bằng composition.Split 'what' from 'how' into two independent hierarchies joined by composition.Chưa họcNot started
  7. 12FlyweightDùng chung phần dữ liệu nặng, bất biến giữa hàng nghìn object để tiết kiệm bộ nhớ.Share the heavy, immutable part of thousands of objects to save memory.Chưa họcNot started

Học phần 3Module 3 · Hành viBehavioral

Nhóm pattern về cách các object phân chia trách nhiệm và trò chuyện với nhau.Patterns about how objects share responsibilities and communicate.

0/11 hoàn thànhcompleted
  1. 13StrategyĐóng gói từng thuật toán thành object riêng để hoán đổi lúc chạy.Wrap each algorithm in its own object so you can swap them at runtime.Chưa họcNot started
  2. 14ObserverKhi một object thay đổi, mọi object đăng ký theo dõi được báo tự động — mà nó không cần biết họ là ai.When one object changes, every subscriber is notified automatically — without it knowing who they are.Chưa họcNot started
  3. 15Template MethodCố định khung các bước của một thuật toán, chỉ để trống vài bước cho lớp con hoặc callback điền vào.Fix the skeleton of an algorithm and leave a few steps for subclasses or callbacks to fill in.Chưa họcNot started
  4. 16CommandBiến một yêu cầu thành object để lưu, xếp hàng, ghi log hoặc undo.Turn a request into an object so you can store, queue, log or undo it.Chưa họcNot started
  5. 17StateObject đổi hành vi khi trạng thái bên trong đổi — mỗi trạng thái là một object riêng.An object changes behaviour when its internal state changes — each state is its own object.Chưa họcNot started
  6. 18Chain of ResponsibilityChuyền yêu cầu qua một chuỗi handler — mỗi mắt xích tự xử lý, chuyền tiếp hoặc chặn lại.Pass a request along a chain of handlers — each link handles it, passes it on, or stops it.Chưa họcNot started
  7. 19IteratorDuyệt từng phần tử của một tập hợp mà không cần biết nó được lưu (hay tải) ra sao.Walk through a collection one element at a time without knowing how it's stored (or loaded).Chưa họcNot started
  8. 20MediatorCác object không nói chuyện trực tiếp với nhau mà đi qua một trung gian điều phối.Objects stop talking to each other directly and go through one coordinating middleman.Chưa họcNot started
  9. 21MementoChụp lại trạng thái của object để khôi phục sau, mà không phơi bày bên trong nó.Capture an object's state to restore it later, without exposing its internals.Chưa họcNot started
  10. 22VisitorThêm thao tác mới cho cả một họ kiểu dữ liệu mà không sửa các kiểu đó.Add new operations to a whole family of types without editing those types.Chưa họcNot started
  11. 23InterpreterBiểu diễn một ngôn ngữ nhỏ bằng cây object, mỗi luật ngữ pháp là một class biết tự 'thông dịch'.Represent a small language as a tree of objects, where each grammar rule is a class that interprets itself.Chưa họcNot started

Học phần 4Module 4 · Doanh nghiệpEnterprise

Pattern dùng hằng ngày khi xây backend thật: tầng dịch vụ, truy cập dữ liệu, giao dịch phân tán, chịu lỗi.Patterns you use daily in real backends: service layers, data access, distributed transactions, resilience.

0/12 hoàn thànhcompleted
  1. 24Dependency InjectionObject không tự new dependency — có người khác tạo sẵn rồi 'tiêm' vào cho nó.Objects don't `new` their dependencies — someone else builds them and injects them in.Chưa họcNot started
  2. 25RepositoryGiả vờ dữ liệu nằm trong một collection trong bộ nhớ — giấu SQL sau một interface.Pretend your data lives in an in-memory collection — hide the SQL behind an interface.Chưa họcNot started
  3. 26Service LayerMột tầng duy nhất chứa các use case: điều phối repository, transaction và quy tắc nghiệp vụ.One layer holding the use cases: it orchestrates repositories, transactions and business rules.Chưa họcNot started
  4. 27Data Transfer ObjectObject 'đóng gói' riêng cho việc gửi dữ liệu qua ranh giới — không bao giờ phơi entity ra API.A dedicated 'shipping box' for data crossing a boundary — never expose your entities through the API.Chưa họcNot started
  5. 28SpecificationBiến mỗi điều kiện lọc thành một object nhỏ, rồi ghép and/or/not như lắp Lego.Turn each filter condition into a small object, then combine them with and/or/not like Lego.Chưa họcNot started
  6. 29Unit of WorkGhi lại mọi thay đổi trong một nghiệp vụ rồi commit tất cả cùng lúc — hoặc không gì cả.Track every change in a business operation, then commit them all at once — or nothing at all.Chưa họcNot started
  7. 30Retry with Exponential BackoffGọi lại khi gặp lỗi tạm thời, mỗi lần chờ lâu gấp đôi và thêm chút ngẫu nhiên.Re-run a call on transient failures, waiting twice as long each time plus some randomness.Chưa họcNot started
  8. 31Circuit BreakerNgắt mạch khi dịch vụ phụ thuộc lỗi liên tục, trả lời nhanh bằng fallback thay vì chờ chết chùm.Trip the circuit when a dependency keeps failing and answer fast with a fallback instead of failing together.Chưa họcNot started
  9. 32CQRSTách mô hình GHI (command) và mô hình ĐỌC (query) để tối ưu từng bên riêng.Split the WRITE model (commands) from the READ model (queries) so each can be optimised on its own.Chưa họcNot started
  10. 33Event SourcingKhông lưu trạng thái hiện tại — lưu chuỗi sự kiện đã xảy ra, rồi phát lại để tính ra trạng thái.Don't store the current state — store the sequence of events that happened, and replay them to get the state.Chưa họcNot started
  11. 34Transactional OutboxGhi dữ liệu nghiệp vụ và event vào cùng một transaction DB, rồi một relay đẩy event sang broker.Write the business row and the event in one DB transaction, then a relay pushes the event to the broker.Chưa họcNot started
  12. 35SagaChia giao dịch xuyên nhiều service thành chuỗi bước cục bộ, lỗi thì chạy bước bù trừ theo chiều ngược lại.Split a cross-service transaction into local steps; on failure, run compensating steps in reverse.Chưa họcNot started

Học phần 5Module 5 · Đồng thờiConcurrency

Pattern xử lý song song: chia việc, gom kết quả, giới hạn tốc độ, huỷ tác vụ — nơi Go toả sáng.Patterns for parallel work: splitting jobs, merging results, throttling, cancelling — where Go shines.

0/10 hoàn thànhcompleted
  1. 36Producer-ConsumerBên sinh việc bỏ vào hàng đợi, bên xử lý lấy ra — hai bên chạy độc lập, khác tốc độ.Producers put work into a queue, consumers take it out — both run independently at their own pace.Chưa họcNot started
  2. 37Worker PoolDùng N worker cố định để xử lý hàng nghìn job — song song nhưng có giới hạn.Use a fixed N workers to process thousands of jobs — parallel, but bounded.Chưa họcNot started
  3. 38Future / PromiseKhởi động việc chậm ngay bây giờ, nhận về một 'phiếu hẹn' để lấy kết quả sau.Start slow work now and get an 'IOU' you can redeem for the result later.Chưa họcNot started
  4. 39PipelineChia việc xử lý thành chuỗi các công đoạn nối nhau, mỗi công đoạn chạy song song với công đoạn khác.Split processing into a chain of connected stages, each running concurrently with the others.Chưa họcNot started
  5. 40Fan-out / Fan-inChia việc ra nhiều goroutine/thread chạy song song (fan-out), rồi gộp kết quả về một mối (fan-in).Spread work across many goroutines/threads in parallel (fan-out), then merge the results into one stream (fan-in).Chưa họcNot started
  6. 41Cancellation / ContextTruyền tín hiệu huỷ và deadline xuống mọi tác vụ con để không ai làm việc vô ích.Propagate cancel signals and deadlines down to every sub-task so nobody works for nothing.Chưa họcNot started
  7. 42SemaphorePhát N 'vé' để giới hạn tối đa N tác vụ cùng chạm vào một tài nguyên tại một thời điểm.Hand out N 'tickets' so at most N tasks touch a resource at the same time.Chưa họcNot started
  8. 43Rate LimiterGiới hạn số thao tác trong mỗi khoảng thời gian, vẫn cho phép một 'cú bùng' (burst) nhỏ.Cap how many operations happen per unit of time, while still allowing a small burst.Chưa họcNot started
  9. 44Read-Write LockCho nhiều người đọc cùng lúc, nhưng người ghi thì phải độc quyền.Many readers at once, but a writer gets exclusive access.Chưa họcNot started
  10. 45Publish-SubscribePublisher gửi message vào một topic; mọi subscriber của topic đó đều nhận một bản, không ai biết ai.Publishers send messages to a topic; every subscriber of that topic gets a copy, and nobody knows anybody.Chưa họcNot started