Behavioral pattern
This pattern helps you to define the behavior of your code, or why a particular code is written in the way is has been written.
Command
When you write code, it should be commanding other code to give some expected result based on the inputs that are provided. This type of pattern coding has some inputs called parameters. They are being sent to some functionality to process the result and give it back to us.
A simple example is the process of making toast. You provide the toaster with the bread. The toaster does its work of heating the bread and gives out the result as toast.
Observer
The observer pattern is a pattern where multiple objects subscribed to one observer change based on changes made on that observer.
It basically works like a one-to-many pattern, where changes made to the observer lead to the necessary changes on all the subscribed objects.
The two major components here are the Observable and the Subscribers.
The Observable is a piece of code that contains a major...