Bài giảng Kiến trúc phần mềm - Bài 2: Mẫu thiết kế Creational Patterns - Trần Minh Triết

Mở đầu

 Ý tưởng về mẫu thiết kế

 Sự ra đời của ý tưởng về mẫu thiết kế

 23 mẫu thiết kế của nhóm GoF

 Nhóm Creational Pattern

 Nhóm Behavioral Pattern

 Nhóm Structural Pattern

 Một số quan điểm về cách vận dụng mẫu thiết kế

 Một số nguyên lý cơ bản của lập trình hướng đối tượng

pdf 29 trang phuongnguyen 7980
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Kiến trúc phần mềm - Bài 2: Mẫu thiết kế Creational Patterns - Trần Minh Triết", để tải tài liệu gốc về máy hãy click vào nút Download ở trên

Tóm tắt nội dung tài liệu: Bài giảng Kiến trúc phần mềm - Bài 2: Mẫu thiết kế Creational Patterns - Trần Minh Triết

Bài giảng Kiến trúc phần mềm - Bài 2: Mẫu thiết kế Creational Patterns - Trần Minh Triết
CTT526 - Kiến trúc phần mềm
Mẫu thiết kế
Creational Patterns
PGS.TS. Trần Minh Triết
tmtriet@fit.hcmus.edu.vn
Trường Đại học Khoa Học Tự Nhiên
Khoa Công Nghệ Thông Tin
Bộ môn Công Nghệ Phần Mềm
Version 1.0 CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mở đầu
 Ý tưởng về mẫu thiết kế
 Sự ra đời của ý tưởng về mẫu thiết kế
 23 mẫu thiết kế của nhóm GoF
 Nhóm Creational Pattern
 Nhóm Behavioral Pattern
 Nhóm Structural Pattern
 Một số quan điểm về cách vận dụng mẫu thiết kế
 Một số nguyên lý cơ bản của lập trình hướng đối tượng
2
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu thiết kế trong nhóm 
Creational Pattern
 Mẫu Factory
 Mẫu Abstract Factory
 Mẫu Builder
 Mẫu Prototype
 Mẫu Singleton
12/09/201
2
3
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Factory
12/09/201
2
4
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Factory
12/09/201
2
5
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Factory
12/09/201
2
6
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Factory
12/09/201
2
7
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Factory
12/09/201
2
8
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Thảo luận
 Trong những tình huống nào nên nghĩ đến mẫu 
Factory?
 Làm cách nào để xác định muốn tạo ra sản phẩm loại 
nào từ Factory?
 Làm cách nào để tạo lập một sản phẩm theo yêu cầu?
 Các biến thể?
12/09/201
2
9
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Prototype
12/09/201
2
10
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Prototype
12/09/201
2
11
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Prototype
12/09/201
2
12
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Thảo luận
 Trong những tình huống nào nên sử dụng mẫu 
Prototype
 Có phải chỉ sử dụng mẫu này trong quá trình tạo lập?
 Những vấn đề khác?
12/09/201
2
13
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Builder
12/09/201
2
14
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Builder
12/09/201
2
15
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Builder
12/09/201
2
16
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Builder
12/09/201
2
17[Christopher G. Lasater (2007). Design Patterns, 
Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Builder
12/09/201
2
18
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Thảo luận
 Những tình huống nào nên dùng mẫu Builder?
 Cách xây dựng các đối tượng thành phần?
 Những vấn đề khác
12/09/201
2
19
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Abstract Factory
12/09/201
2
20
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Abstract Factory
12/09/201
2
21
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Abstract Factory
12/09/201
2
22
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Abstract Factory
12/09/201
2
23
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Abstract Factory
12/09/201
2
24
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Thảo luận
 Những tình huống nào nên sử dụng mẫu Abstract 
Factory?
 Abstract Factory với Factory và Builder?
 Những vấn đề khác
12/09/201
2
25
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Singleton
12/09/201
2
26
[Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1995). Design Patterns - Elements of Reusable Object-Oriented 
Software, Addison-Wesley]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Mẫu Singleton
12/09/201
2
27
[Christopher G. Lasater (2007). Design Patterns, Wordware Publishing, Inc.]
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Thảo luận
 Những tình huống nào nên dùng mẫu Singleton?
 Có nhất thiết phải là “single” – đối tượng duy nhất?
 Làm sao để quản lý số lượng thể hiện (đối tượng) của 
một lớp?
 Ràng buộc về số lượng được xét trong toàn bộ quá 
trình thực thi ứng dụng hay được xét riêng tại mỗi thời 
điểm?
12/09/201
2
28
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Tổng kết
 Những tính chất chung của nhóm mẫu thiết kế 
Creational Pattern
 Những biến thể của các mẫu thiết kế trong nhóm 
Creational Pattern
 Những vấn đề khác
12/09/201
2
29
CuuDuongThanCong.com https://fb.com/tailieudientucntt

File đính kèm:

  • pdfbai_giang_kien_truc_phan_mem_mau_thiet_ke_creational_pattern.pdf