The document discusses design patterns, which are templates for solving common programming problems. It provides examples of different categories of design patterns, including creational (e.g. factory method), structural (e.g. adapter), and behavioral (e.g. observer, command). For each pattern, it describes the problem it addresses and provides a high-level overview of the solution approach. Specific patterns like singleton, factory, facade, adapter, observer, and command are explained in more detail with illustrations.
2. Apa itu Design Pattern ??
•
Design pattern adalah solusi yang digunakan
untuk menyelesaikan masalah-masalah umum
yang ditemukan dalam design perangkat lunak.
•
Design pattern berupa template
•
Design pattern bukan termasuk algoritma
11. Factory Pattern
When we use it?
• When our object or component setup involves a
high level of complexity
• When we need to easily generate different
instances of objects depending on the environment
we are in
• When we're working with many small objects or
components that share the same properties
• When composing objects with instances of other
objects that need only satisfy an API contract (aka,
duck typing) to work. This is useful for decoupling.
22. Observer Pattern
Konsep Utama dari Obserever Pattern adalah saat terdapat
kelas tertentu (Observer) yang perlu mengetahui aktifitas
dari kelas lain (Subject)
26. Command Pattern
Intent
• Encapsulate a request in an object
• Allows the parameterization of clients with
different requests
• Allows saving the requests in a queue