DEV Community

Cephas Arowolo Oluwadamilola
Cephas Arowolo Oluwadamilola

Posted on

Architectural Patterns In Mobile Development

Starting from early button laden phones developed by companies like motorola and nokia to more modern touch screen phones developed by Apple back in 2007, development on those devices always follow a architectural pattern. According to Wikipedia, software architecture has its roots in the late 1970s but it was till the early 2000s before they really started to be used. In this post, we will be going over the common architectural patterns used in mobile development, touching on their pros and cons while giving instances when each of them should be used. More specifically, we will be looking into the Model View Controller (MVC) Architecture, the Model View Presenter (MVP) Architecture and the Model View View Model (MVVM) Architecture.

1. Model View Controller (MVC)
This architecture divides an application into three interacting parts as the name implies, the Model, the View and the Controller.
-Model:
This holds the data to be displayed to the user. This is the part that is mostly used to interact with the database
-View:
This displays the data gotten from the model to the end user as the name implies.
-Controller:
This is what connects the model to the view. This accepts input data from the view, processes it and sends it to the model while returning the proccessed information to the view.

Advantages of MVC architecture:

  • Very fast developement speed.
  • Easy debugging and bug fixing speed as it is very easy to track down where an issue might be occuring.
  • Makes it easier to make changes and update the application.
  • Makes writing of tests easier as there is separation of logic.

Disadvantages of MVC architecture:

  • It is hard to understand the MVC architecture.
  • Must have strict rules on methods

2. Model View Presenter (MVP)
This is similar to the MVC architecture but for a simple difference, the presenter takes over a lot of the View responsibilites. Accepting of input, choosing when to display it, etc are all managed by the Presenter here. The View only function is to display that data. No logic of any sort goes on in the View layer. The advantages are similar to the MVC advantages.

Disadvantages of MVP architecture:

  • More harder to learn and use than the MVC architecture
  • Not suitable for small and simple apps.

2. Model View View Model (MVVM) Architecture
MVVM is the most used architecture in mobile developement.This is very similar to MVC and can be confused with it sometimes. The difference is the view model allows for two way coomunication between the view and the model while MVC only allows for one way communication. Also while there is always a single controller for multiple views in MVC, in MVVM, each views has its own viewmodel which exposes methods for it to communicate directly with the model. The advantages and disavantages are very similar to the MVC ones except for the caveat that its more complex to use and manage than the MVC architecture.

Moving On
Selecting the best architecture to use is a process of its own. This highly depends on the complexity of the project, the application functions, the organization vision and even the developer's experience level. As a beginner, all this can be overwhelming which is why HNG is providing hands on experience to bring a beginners level up to where they would be able to comfortably choose what architecture they should use. If you are intrested in participating, then head over to https://hng.tech/internship to get started. If you are also looking to hire experienced devs. Then head over to https://hng.tech/hire to get your fit.

Top comments (0)