Design Pattern And Mvc Architecture Explained

Design Pattern And Mvc Architecture Explained

INTRODUCTION

The MVC architecture is a design pattern or way of developing applications in a pattern such that the application is divided into three major components namely: Model, View and Controller. Let's see what a design pattern is, why it is important and what MVC is.

WHAT IS A DESIGN PATTERN ?

  • A design pattern is a way of developing applications/ software (generally large ones) to address similar problems such that we use an acceptable model/solution that people with similar problems can reuse.

  • Imagine you and your community are faced with a problem that repeats itself over and over. You come up with a solution, unfortunately your community finds it difficult to solve the same problem. In order to help them, you design a reusable pattern(framework) that will help them solve the same type of problem. This what we generally call a design pattern

WHAT IS MVC ?

  • As said earlier MVC is a design pattern thus makes life easier by giving a framework to solve a reoccurring problem. MVC stands for Model, View and Controller.

  • Model refers to the database or schema. It defines the data (variables) that are used in solving the problem. It can be a database, JSON data or any other source of data that is used or the user will interact with.

  • View refers to the user interface. It is the front end from which users of the application will interact from and input data.

  • Controller is the logic of the application. He decides what happens at what moment. It contains all the application logic and is generally the middle man between the model and the view.

  • When a user enters an application, he is presented with the view from which he can interact and enter information. This information depending on the action performed will be transformed in a suitable manner by the controller and sent to the model where it will be stored.
  • In order to architect your software using a the MVC architecture, you should create a three separate folders. One for view, one for controller and the last for model and reference them accordingly in your different files.

CONCLUSION

Now that you know what MVC do not forget to implement it when developing your applications. If you liked this post, please share and follow. Thank you!