Model-view-controller(MVC) is a web application framework as well as design-pattern and widely usednow when developing a modern, data intensive web application. Most webapplication frameworks use the Model-view-controller (MVC) architecturalpattern to separate an application’s logic from its data and presentation.
Fora long time this pattern has been a popular choice amongst developers designingweb applications. TheMVC design architectural pattern promotes cohesion (classes that represent ordefine only one type of object) and aims for low coupling (a measure of howmuch classes are interrelated). In UI object oriented programming, it isconsidered bad practice to mix presentation and data code. Instead, classescalled controllers are defined to mediate communication between presentationand data classes. These Controller classes decouple the presentation layer andthe data layer classes, consequently allowing them to be defined morespecifically. Advantagesof high cohesion are said to be reduced module complexity, increased systemmaintainability, and increased module reusability.
High cohesion creates aseparation of concerns in the code base allowing developer specialization andfocus, and parallel development if working in teams.Model-View-Controller(MVC) is typically made up of three classes as mentioned in its name. Thecontroller is the intermediary class between the model and the view classes.
Itcontrol the flow of information by accepting user input from the view, andinstructs both the model and view to perform actions based on that informationas shown in the following figure. Themodel is responsible for the data management routines in the application. Theseare commonly create, read, update, and delete (CRUD) database operations. Theview is responsible for presenting the data from the model, and normallycontains mostly mark-up displayed as web pages, for example RSS feeds.
TheMVC web framework appears 2002, the use of the MVC pattern in web applicationdesign became popular after it was introduced in the spring web developmentframework for the java programming language. It was then implemented for theRuby programming language in 2006 under the name Ruby on Rails, and later asDjango for the Python programming language; ASP.NET MVC for C#; along withnumerous implementations for PHP. These frameworks have evolved/adapted theoriginal MVC pattern into slightly different versions to better fit theirconcept of application design for the web. Regardless of these variations, theyare still commonly known as MVC web development frameworks.Thebenefits of the MVC pattern in web development are Separating code intocategories such as models, views and controllers, allow the developer todevelop specific areas of project functionality. This will then lead to aneasier to manage, more readable code base, when a part of the application needsto be fixed, tested, or extended.
This is commonly known as separation ofconcerns, and if one is working as part of a team, it is especially useful forseparating developer workloads as one can have for example, three developersworking on different areas in the same part of the application –the model, theview, and the controller.Clientand Server Interaction within Web Application:Client/server is a program relationship in which oneprogram (the client) requests a service or resource from another program(the server). Although the client/server model can be used byprograms within a single computer, it is a more important concept for networking.The basic architecture ofa Web application is same like simple Client Server architecture and includesbrowsers, a network, and a Web server. Browsers request Web pages from theserver. Each page is a mix of content and formatting instructions expressedwith HTML.
Some pages include client side scripts that are interpreted by thebrowser. Fromthe client’s perspective, the Web page is always an HTML formatted document. Onthe server, however, a Web page may manifest itself in a number of differentways. The ultimate result of the client web request processing is anHTML-formatted stream that is sent back to the requesting client. Businesslogic is executed in the system while processing the file. During that time ithas the potential to interact with server side resources such as databases andmiddle tier components.
Today’sWeb servers have improved upon this basic design. Current Web servers are muchmore security aware, and include features like management of client state onthe server, transaction processing integration, remote administration, andresource pooling. Web page (or the streamed HTML output of that page) on theclient has a completely different behavior and set of relationships. On theclient, a scripted page has relationships with the browser itself (via theDocument Object Model or DOM). Theserver side aspect of a Web page can be modeled with one class and the clientside aspect with another. A common relationship between Web pages is thehyperlink. A hyperlink in a Web application represents a navigational paththrough the system. This association always originates from a client page andpoints to either a client or server page.
Hyperlinks are implemented in thesystem as a request for a Web page, which are modeled as components in theImplementation View. A link association to a client page is essentially equivalentto a link association to the server page that builds the client page. This isbecause a link is actually a request for a page.
Client/serveris a computer architecture that divides functions into client (requestor) andserver (provider) subsystems, with standard communication methods (such asTCP/IP) to facilitate the sharing of information between them. The client andserver can be distinguished from one another by the differences in tasks theyperform. The client and server usually operate on different computer platforms.Either the client or server may be upgraded without affecting the other.Clients may connect to one or more servers; servers may connect to multipleclients concurrently. Clients always initiate the dialogue by requesting aservice.