This article is currently in the process of being translated into Portuguese (~35% done).
If you are fluent in Portuguese, then please help us - just point to any untranslated element (highlighted with a yellow left border - remember that images should have their titles translated as well!) inside the article and click the translation button to get started. Or have a look at the current translation status for the Portuguese language.
If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.
Please help us by translating the following metadata for the article/chapter, if they are not already translated.
If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed. Please only submit an altered translation of a metadata item if you have good reasons to do so!
What is MVC?
MVC, acrônimo para Model-View-Controller, é um padrão de software originalmente desenvolvido na década de 70, quando as interfaces gráficas de usuário ainda estavam no início de desenvolvimento. O MVC busca separar a aplicação em três áreas:
Aqui é onde os dados e as regras de negócio são armazenadas. Numa aplicação web típica, esta parte representaria, por exemplo, uma tabela de banco de dados ou qualquer outro objeto que a sua aplicação possa tratar.
A Visão (View) é a representação visual do seu modelo (Model). Numa aplicação Web típica, a View seria a página que apresenta o modelo para o usuário, podendo ser um formulário de entrada de dados, uma pagina só de apresentação de dados ou uma combinação das duas. Obviamente a Visão não precisa apresentar todas as partes do modelo e o modelo pode ter mais de uma View.
The Controller should handle all communication between your Model and your View. In a typical web application, the methods of the Controller are invoked by the user when a page is loaded or a button is clicked. The Controller then updates the Model, if necessary, and then returns a new View (or action, but more about that later), if necessary.
The Rise of MVC
After being introduced in the 1970's, the MVC pattern didn't get much attention for the next 30 years. Early web languages, like Perl, PHP and ASP Classic didn't really focus on design patterns and even with the release of ASP.NET, MVC was still not an integrated part of it. Sure, you could apply MVC techniques to your projects, but none of the popular frameworks encouraged it in any way.
Then, in 2004, the Ruby on Rails framework was released, which was a web development framework based on the Ruby language with heavy inspiration from the MVC pattern. A lot of people believe that this put the focus back on MVC and shortly thereafter, many PHP frameworks, centered around the MVC pattern, was released. All of this made the MVC pattern hugely popular, which is probably why Microsoft decided to do an implementation of it for their .NET framework, including massive tool support in their Visual Studio IDE. ASP.NET MVC was released in 2007, but the first final version didn't see the light of day before 2009.
In the next chapters, we will look deeper into what ASP.NET MVC is all about and how it compares to the alternatives, mainly ASP.NET WebForms.