From d583a9dc930ba250135ca795c5207f8343ba7411 Mon Sep 17 00:00:00 2001 From: muqiuhan Date: Thu, 20 Mar 2025 10:09:58 +0000 Subject: deploy: 951ed14c0cac247fa7f1e571c9fe27442d10dd26 --- .../index.html" | 6 - .../index.html" | 18 -- .../19/Repository-pattern-in-Typescript/index.html | 18 -- .../index.html" | 8 +- .../index.html" | 284 +++++++++++++++++++ .../index.html" | 2 +- .../index.html" | 5 + .../index.html" | 286 +++++++++++++++++++ .../index.html" | 306 +++++++++++++++++++++ 9 files changed, 883 insertions(+), 50 deletions(-) create mode 100644 "2025/03/14/DDD-\344\270\255\347\232\204-Ubiquitous-Languages/index.html" create mode 100644 "2025/03/20/TDD-\345\222\214-DDD-\347\232\204\344\270\200\344\272\233\345\260\217\346\203\263\346\263\225/index.html" create mode 100644 "2025/03/20/\350\202\272\345\212\237\350\203\275\346\243\200\346\237\245\346\225\260\345\200\274/index.html" (limited to '2025') diff --git "a/2025/02/10/\345\256\236\346\227\266\346\220\234\347\264\242\344\270\255\347\232\204\351\230\262\346\212\226\345\207\275\346\225\260/index.html" "b/2025/02/10/\345\256\236\346\227\266\346\220\234\347\264\242\344\270\255\347\232\204\351\230\262\346\212\226\345\207\275\346\225\260/index.html" index 3dd4c273..76369555 100644 --- "a/2025/02/10/\345\256\236\346\227\266\346\220\234\347\264\242\344\270\255\347\232\204\351\230\262\346\212\226\345\207\275\346\225\260/index.html" +++ "b/2025/02/10/\345\256\236\346\227\266\346\220\234\347\264\242\344\270\255\347\232\204\351\230\262\346\212\226\345\207\275\346\225\260/index.html" @@ -146,12 +146,6 @@ Technique - - - - Web - - diff --git "a/2025/02/18/Prisma-\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223\347\232\204-Self-relations/index.html" "b/2025/02/18/Prisma-\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223\347\232\204-Self-relations/index.html" index fef22ae8..07feb856 100644 --- "a/2025/02/18/Prisma-\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223\347\232\204-Self-relations/index.html" +++ "b/2025/02/18/Prisma-\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223\347\232\204-Self-relations/index.html" @@ -146,24 +146,6 @@ Technique - - - - Web - - - - - - Typescript - - - - - - Database - - diff --git a/2025/02/19/Repository-pattern-in-Typescript/index.html b/2025/02/19/Repository-pattern-in-Typescript/index.html index e8a622a5..d5a0b590 100644 --- a/2025/02/19/Repository-pattern-in-Typescript/index.html +++ b/2025/02/19/Repository-pattern-in-Typescript/index.html @@ -146,24 +146,6 @@ Technique - - - - Web - - - - - - Typescript - - - - - - Software-Engineering - - diff --git "a/2025/03/13/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\347\232\204\342\200\234\350\201\232\345\220\210\346\240\271\342\200\235/index.html" "b/2025/03/13/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\347\232\204\342\200\234\350\201\232\345\220\210\346\240\271\342\200\235/index.html" index f873f090..9d5309c5 100644 --- "a/2025/03/13/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\347\232\204\342\200\234\350\201\232\345\220\210\346\240\271\342\200\235/index.html" +++ "b/2025/03/13/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\347\232\204\342\200\234\350\201\232\345\220\210\346\240\271\342\200\235/index.html" @@ -146,12 +146,6 @@ Technique - - - - Software Engineering - - @@ -203,7 +197,7 @@
- Prev + Prev
diff --git "a/2025/03/14/DDD-\344\270\255\347\232\204-Ubiquitous-Languages/index.html" "b/2025/03/14/DDD-\344\270\255\347\232\204-Ubiquitous-Languages/index.html" new file mode 100644 index 00000000..2916b4d3 --- /dev/null +++ "b/2025/03/14/DDD-\344\270\255\347\232\204-Ubiquitous-Languages/index.html" @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + +DDD 中的 Ubiquitous Language | 暮秋小屋 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+ + + +
+
+
+ + + +
+
+
+ + +
+ +
+ +
+ +
+
+
+

Ubiquitous Language(通用语言)是 Domain-Driven Design (DDD) 中的一个核心概念。它是一种共享的、统一的语言,用于描述和讨论领域模型中的概念和规则。Ubiquitous Language 的目的是确保开发团队和业务专家之间的沟通更加高效和准确,从而减少误解和错误。

+

一般来说,Ubiquitous Language 有以下特点:

+
    +
  1. 共享:Ubiquitous Language 是由开发团队和业务专家共同创建和使用的。它不仅用于代码和文档,还用于日常的沟通和讨论。
  2. +
  3. 统一:在整个项目中,Ubiquitous Language 应该是一致的。无论是在代码、文档、会议还是白板上,都应该使用相同的术语和概念。
  4. +
  5. 精确:Ubiquitous Language 应该尽可能精确,避免模糊和歧义。每个术语都应该有明确的定义和含义。
  6. +
  7. 演进:Ubiquitous Language 是动态的,会随着项目的进展和业务需求的变化而演进。团队应该定期审查和更新它。
  8. +
+

基于此,它可以用在这些地方:

+
    +
  1. 命名:在代码中使用 Ubiquitous Language 来命名类、方法、变量等。例如,如果业务专家使用“订单”来描述一个概念,那么在代码中也应该使用“Order”而不是“Purchase”或“Transaction”。
  2. +
  3. 文档:在文档中使用 Ubiquitous Language 来描述系统的设计、架构和功能。这有助于业务专家更容易理解技术文档。
  4. +
  5. 沟通:在团队会议、讨论和白板会议中使用 Ubiquitous Language。这有助于确保所有参与者都在讨论同一个概念。
  6. +
  7. 测试:在编写测试用例时,使用 Ubiquitous Language 来描述测试的前提条件、步骤和预期结果。这有助于确保测试覆盖了业务需求。
  8. +
+

假设正在开发一个电子商务系统,业务专家使用“订单”来描述用户购买的商品集合。团队可以在代码中使用“Order”来命名相关的类和方法:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
type Order = {
items: OrderItem list
customer: Customer
orderDate: DateTime
}

type OrderItem = {
product: Product
quantity: int
}

type Customer = {
name: string
}

type Product = {
name: string
price: float
}

let addItem (order: Order) (item: OrderItem) =
{ order with items = order.items @ [item] }

let getTotalAmount (order: Order) =
let total = 0.0
for item in order.items do
total <- total + item.price
total

let getPrice (item: OrderItem) =
item.product.price * item.quantity

let getTotalPrice (order: Order) =
let total = 0.0
for item in order.items do
total <- total + getPrice(item)
total
+ +

在这个示例中使用了“Order”、“OrderItem”、“Customer”和“Product”等术语,这些术语都是 Ubiquitous Language 的一部分,可以提高代码与业务需求的一致性。

+ +
+ + + + + +
+ + + + + + + +
+ + +
+
+
+ + + +
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + + + + + + diff --git "a/2025/03/17/\344\272\214\343\200\207\344\272\214\344\272\224\345\271\264\344\270\211\346\234\210\345\215\201\344\270\203\346\227\245/index.html" "b/2025/03/17/\344\272\214\343\200\207\344\272\214\344\272\224\345\271\264\344\270\211\346\234\210\345\215\201\344\270\203\346\227\245/index.html" index 581b94b2..b2bb83a9 100644 --- "a/2025/03/17/\344\272\214\343\200\207\344\272\214\344\272\224\345\271\264\344\270\211\346\234\210\345\215\201\344\270\203\346\227\245/index.html" +++ "b/2025/03/17/\344\272\214\343\200\207\344\272\214\344\272\224\345\271\264\344\270\211\346\234\210\345\215\201\344\270\203\346\227\245/index.html" @@ -303,7 +303,7 @@ mjx-container[display="true"] + br {
- Next + Next
diff --git "a/2025/03/19/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\350\201\232\345\220\210\346\240\271\346\214\201\344\271\205\345\214\226\345\222\214\344\272\213\344\273\266\345\217\221\345\270\203\345\217\257\350\203\275\345\257\274\350\207\264\346\225\260\346\215\256\344\270\215\344\270\200\350\207\264\351\227\256\351\242\230/index.html" "b/2025/03/19/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\350\201\232\345\220\210\346\240\271\346\214\201\344\271\205\345\214\226\345\222\214\344\272\213\344\273\266\345\217\221\345\270\203\345\217\257\350\203\275\345\257\274\350\207\264\346\225\260\346\215\256\344\270\215\344\270\200\350\207\264\351\227\256\351\242\230/index.html" index 6aa2f2cf..0fed5232 100644 --- "a/2025/03/19/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\350\201\232\345\220\210\346\240\271\346\214\201\344\271\205\345\214\226\345\222\214\344\272\213\344\273\266\345\217\221\345\270\203\345\217\257\350\203\275\345\257\274\350\207\264\346\225\260\346\215\256\344\270\215\344\270\200\350\207\264\351\227\256\351\242\230/index.html" +++ "b/2025/03/19/\351\242\206\345\237\237\351\251\261\345\212\250\350\256\276\350\256\241\344\270\255\350\201\232\345\220\210\346\240\271\346\214\201\344\271\205\345\214\226\345\222\214\344\272\213\344\273\266\345\217\221\345\270\203\345\217\257\350\203\275\345\257\274\350\207\264\346\225\260\346\215\256\344\270\215\344\270\200\350\207\264\351\227\256\351\242\230/index.html" @@ -217,6 +217,11 @@