We are faced with the task of developing an application that, as an example, will provide an opportunity for the user, within our application, to create an account or create a store. In this view, we are only interested in the part that is responsible for redirecting to the account creation and store pages.
This pattern provides an interface for creating objects without explicitly creating instances of their concrete classes.Our creation form will have a title, form fields, and a URL to which the form data will be sent.
This class implements the interface of the factory for creating specific components of the account creation form.Next, we will implement the above interfaces for the store creation form.
It is enough for us to have one instance of this class in each of the controllers.