development:software-architecture:design-patterns:factory
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
development:software-architecture:design-patterns:factory [2024/08/16 03:50] – [Factory Method Pattern] tungnt | development:software-architecture:design-patterns:factory [2024/08/19 09:29] (current) – tungnt | ||
---|---|---|---|
Line 128: | Line 128: | ||
{{ : | {{ : | ||
+ | |||
+ | **Tóm lại:** Method Factory dùng khi có nhiều cách thức khác nhau để đạt được 1 mục tiêu, và để khi thêm một cách thức mới thì chúng ta chỉ cần thêm một Class mới tương ứng không phải sửa quá nhiều code trong function xử lý. | ||
**Ví dụ 1:** | **Ví dụ 1:** | ||
+ | |||
+ | {{ : | ||
<file php> | <file php> | ||
Line 248: | Line 252: | ||
**Ví dụ 2:** | **Ví dụ 2:** | ||
+ | |||
+ | {{ : | ||
<file php> | <file php> |
development/software-architecture/design-patterns/factory.1723780255.txt.gz · Last modified: 2024/08/16 03:50 by tungnt