You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -415,15 +415,15 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
415
415
416
416
# Frequently asked questions
417
417
418
-
**Q: What is the difference between State and Strategy patterns?**
418
+
**<aid="Q1">Q: What is the difference between State and Strategy patterns?</a>**
419
419
420
420
While the implementation is similar they solve different problems. The State pattern deals with what state an object is in - it encapsulates state-dependent behavior. The Strategy pattern deals with how an object performs a certain task - it encapsulates an algorithm.
421
421
422
-
**Q: What is the difference between Strategy and Template Method patterns?**
422
+
**<aid="Q2">Q: What is the difference between Strategy and Template Method patterns?</a>**
423
423
424
424
In Template Method the algorithm is chosen at compile time via inheritance. With Strategy pattern the algorithm is chosen at runtime via composition.
425
425
426
-
**Q: What is the difference between Proxy and Decorator patterns?**
426
+
**<aid="Q3">Q: What is the difference between Proxy and Decorator patterns?</a>**
427
427
428
428
The difference is the intent of the patterns. While Proxy controls access to the object Decorator is used to add responsibilities to the object.
0 commit comments