Modelview controller (MVC) is a framework for web applications as well asdesign-pattern and widely used now when developing a new, data intensive webapplication. Mostly web application frameworks use the Model view controller(MVC) pattern to separate the whole application’s business logic into differenttiers. For a long time this pattern has been a most usable choice amongstdevelopers designing web applications. TheMVC design structural pattern supports 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.ModelView Controller (MVC) is typically made up of three classes as mentioned in itsname. The controller is the intermediary class between the model and the viewclasses. It control the flow of information by accepting user input from theview, and instructs both the model and view to perform actions based on thatinformation as 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.TheMVC web framework appears in 2002, the use of the MVC pattern in webapplication design became famous after it was introduced in the spring webdevelopment framework for the java programming language. It was thenimplemented for the Ruby programming language in 2006 under the name Ruby onRails, and after that Django for the Python programming language; ASP.NET MVCfor C#; along with numerous implementations for PHP. These frameworks haveevolved/adapted the original MVC pattern into slightly different versions tobetter fit their concept of application design for the web. Regardless of thesevariations, they are 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.
a- Clientand Server Interaction within Web Application:Client/server is a program communicates with one programrequests another program. Although the client/server architecture can beused by programs within a single computer, it is a more important thoughtfor networking.The basic model of a web applicationis same like simple client-server-architecture and includes browsers, anetwork, and a web server. Browsers request web pages from the server. Eachpage is the mixture of content and instructions expressed with HTML.
Some pagesinclude client side scripts that are interpreted by the browser. Fromthe client’s perspective, the Web page is always an HTML document. The endoutput of the client web request processing is an HTML-formatted stream that issent back to the requesting client. Business logic is executed in the systemwhile processing the file. During that time it has the potential to interactwith server side resources such as databases and middle tier components. Today’sweb servers become better 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 mapped with one class and the clientside aspect with another class. A well-known relationship between web pages isthe hyperlink. A hyperlink in a Web application represents an activity paththrough the system. This association always starts from a client page andpoints to either a client or server side page. Hyperlinks are implemented inthe system as a request for a web page, which are mapped 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/protocols(such as TCP over IP) to facilitate the sharing of information between them.The client and server can be identified from one another by the differences intasks they perform. The client and server usually operates on differentcomputer platforms. Either the client or server may be upgraded withoutaffecting the other. Clients may connect to one or more servers; servers mayconnect to multiple clients concurrently. Clients always start the dialogue byrequesting a service. b- AlternativeApproaches to Web Application:There are several options for applicationsdevelopment and all depends on customer needs and requirement.
Alternativeapproaches to web application development are build either desktop applicationor mobile application with same functionality as provided by web applicationfor the end user. A standalone/desktop or thick client refers to anapplication running on a desktop environment such as windows, Linux or Macplatforms. The thick client architecture, where the code runs on the client aswell as the processing of data, was once the norm. With the spreading ofinternet the thin client model become more popular. The thin client also becamemore popular because the standalone applications grew more complex and dependedon third party controls.Everything has some limitations, and that alsoincludes thick clients.
One of the top arguments against thick clients is whenit comes to deployment. Imagine a thousand clients that must be updated. Thisis not an easy task and it takes a lot of time to update all clients. Anotherproblem with a standalone/desktop application is the platform dependency. Athick client requires a local runtime environment. For example a Windows formapplication will only run on a windows platform with the .Net frameworkinstalled. These limitations are overcomes with the ability to work offline.
Itis possible for the application to run offline but it can only work with localdata due to the non-existing internet connection.There are some factors of an application that is going to be developeddepends on application performance, security, usability, and implementation.The Web has very rapidly become central to manyapplications in diverse areas. As our reliance on Web-based applicationscontinues to increase and the Web systems supporting these applications becomemore complex, there is growing concern about the manner in which the Web-basedsystems/applications are created and their quality, integrity andmaintainability. Web performance problem occurs when the web browser requestdata from a server that then returns the result, the traffic over the networkcan become large.
This can lead to congestion which then leads to long transfertime. And the fact that you get the result from the server means that youalways have to be connected to the internet. Another performance problem lieson the server. When requesting a page, the server needs to make somecomputation. If you have a lot of users making requests at the same time theserver can get heavily loaded.A thick client provides a lot of functionality which is not possible ona web application. If we decide to implement a web application we will have toconsider that we will lose some functionality because of the limitations of theweb.
The main advantage of a web based solution is that it is centralized. Thishas its advantages in easy update and deployment. Another advantage is that aweb application is platform independent.