• En
  • /
  • Jp
  • Model-View-Controller (MVC Framework)

    2017.6.8
    • Share
    • Twitter
    • Google+
    • はてなブックマーク
    introduction

    As a software developer, one of our main objective is to make the functionality that is based from the requirements that created during the planning phase of the SDLC. But it is not enough that your code just work, we must also make our code clean, scalable, and readable for other programmers. There are many ways to achieve that goal. Today we will be talking about MVC. MVC is an architectural pattern that separates an application into three main logical components. As the name goes, it is spilt in Model, Controller, and View.

    Outline


    Today I will be introducing the topic of the Model Control View framework (MVC) framework. In this short research paper, we will be discussing the following items:

    • What is MVC?
      • Introduction
      • Model
      • Control
      • View
    • Where and when can we use MVC?
    • What are the sample language and framework that uses MVC?
    untitled

    Model

    • Contains the data layer of the Framework.
    • The object that is created in this layer corresponds to the fields that are created in the database.
    • This is where the view and the controller pulls the data that will be used in View and the Controller layer.

    View

    • Contains the user interface of the solution.
    • Layer where the user interacts with the solution.
    • Contains text, buttons, dropdown button, and any part that the user can see in the solution.

    Controller

    • Contains the logic of the solution
    • This connects the model and the view together.
    • Contains the functions, procedures, flow of the solution.

    When and where can we use MVC?

    Writing codes that work is one thing, writing code that works, clean, readable, and scalable is another thing. This is where MVC is so much useful. Listed below are the ways on how MVC can be applied.

      Clean Code using MVC
      • As MVC Framework has specific Controllers for Views, it will be clean and clear on where the developer will input the specific logic that he needs for the view.

      Readable for other users
      • If the solution that was created followed the proper MVC format, it will be easier for other developers to look for the specific code that they need as they can search for on the specific layer following the MVC structure.

      Code is scalable.
      • Since MVC has a specific format that needs to be followed, it will be easier for the developer to add pages, views, and logic. For example, the developer can add a page and the logic of the page by simply creating a new View and a new Controller. It is scalable in a way that the format is easy to follow and the other pages will not be affected by the changes that you made and the page that you added.

     

    What are the sample language and framework that uses MVC?


    A developer can apply MVC to any programming language if he or she knows the pattern of the MVC that needs to be followed. A user can build his own MVC framework and apply the rules as long as the guideline is followed. Listed below are the other samples of languages and the MVC framework that they are using:

    • PHP Code Igniter
    • PHP Laravel
    • PHP Cake
    • .Net Razor (For ASP.NET)

    Authors Note:

    There are a lot more MVC framework out there. The ones that are listed here are the one that I, Rey Norbert Besmonte, has specific experience on.

    Next week I will be discussing PHP Cake as part of MVC framework research paper that I will be creating every week. This is open for discussion and if I am wrong or missed something, feel free to add it in the comments as I welcome any knowledge to help me grow.