So Software architectural patterns in general are reusable solutions to commonly occurring problems within a given context and the needs of software development cycles. These patterns address various issues in software engineering in general, such as performance, and availability, and minimize risks and bugs. So these patterns are implemented in some software frameworks like MVC, MVVM, and MVP.
1. The MVC: Model-View-Controller
The MVC design pattern framework consists of three main parts :
are the central component of the MVC pattern, it presents all the dynamic data of software also it is independent of the user Interface. Moreover, it directly manages the data, logic, and rules of an application.
The view is the visible side of the app and holds all the information that is displayed on a screen, also now it is the UI/UX part.
The controller has many functionalities that convert all app inputs to a model or a view, and define the main interface of the MVC architect. The controller also has a significant role in validating inputs before passing them to the model.
The MVC is the most adaptable system that can be applied to many programming languages and frameworks like Rails and Django, and for pieces of information, Ruby on Rails is the father of the MVC architect. And it is preferable to use it with desktop software and a Web app. an example of an MVC with Rails :
2. The MVVM: Model-View-ViewModel
The MVVM is another software architectural pattern that manipulates the separation of the user graphical interface from the code using a markup language (XML - HTML-JSX)or graphical code from the business logic or the back-end logic. So the view is not dependent on any specific model platform or interaction until use the -viewmodel- for converting values and exposing objects from the model and also organizes the access logic around the set of use cases that be handled by the view.
Refers to the domain model, which is a real state content(OOP approach), or refers to the data access layer which represents the content in a data-centric approach, similar to the model from MVC.
Like its siblings, it represented the structured layout and appearance of what the user interacts with screens. And also handle the gestures, and inputs from the user and forwards them to the ViewModel.
View Model :
The ViewModel explains an abstraction of the view, exposing properties and commands instead of the MVC controller, and it has a binder that makes it communicate between the view and its properties in the ViewModel, also can be explained as the state of the data to the model. The main problem of the ViewModel that is require binding or generating boilerplate code.
the binder is declarative data and command-binding is implicit in the MVVM pattern. In native mobile development, the Android app for example you find the XML, or in cross-platform like Xamarin uses XAML, so the binder is a Markup language after all.
Now for best implementation for The MVVM pattern is .NET or React JSX also for OG android Developers that keep using Java.
3. The MVP: Model-View-Presenter
Like its father MVC, the model-view-presenter is a derivation of it, using the middle-man concept to be the main controllers and functionalities. Its characteristics are evident in building user interfaces, facilitating automated unit testing, and improving the separation of concerns in presentation logic.
like its ancestors, is defining the data to be stored or displayed and how will be on the user interface.
Also called a passive view, it is the interface that dçsplays the models and routes the user inputs and events to the presenter.
In this pattern, the presenter has a simple role in which it acts upon the model and the view. Retrieves the data from the model and manages it for display on the view.
In this particular pattern, the view which is the passive view has control of the logic and events and forwards all interaction operations to the presenter. the MVP is more suitable for web-based architectures, where the view executes on the client browser. For the best implementation for this pattern .NET, Java and PHP are support it.
the selection of any design pattern or architect pattern depends on the size of the project, and its directions if it is a web app or mobile app, or desktop-based app. Every platform has many different carecteristics and behavior, and language support also has the biggest credits. So as a Software developer moving to a senior engineer it is obligatory to know the difference and implementations for each pattern.