Model-view-controller
(MVC) is a web application framework as well as design-pattern and widely used
now when developing a modern, data intensive web application. Most web
application frameworks use the Model-view-controller (MVC) architectural
pattern to separate an application’s logic from its data and presentation. For
a long time this pattern has been a popular choice amongst developers designing
web applications.
The
MVC design architectural pattern promotes cohesion (classes that represent or
define only one type of object) and aims for low coupling (a measure of how
much classes are interrelated). In UI object oriented programming, it is
considered bad practice to mix presentation and data code. Instead, classes
called controllers are defined to mediate communication between presentation
and data classes. These Controller classes decouple the presentation layer and
the data layer classes, consequently allowing them to be defined more
specifically.
Advantages
of high cohesion are said to be reduced module complexity, increased system
maintainability, and increased module reusability. High cohesion creates a
separation of concerns in the code base allowing developer specialization and
focus, and parallel development if working in teams.
Model-View-Controller
(MVC) is typically made up of three classes as mentioned in its name. The
controller is the intermediary class between the model and the view classes. It
control the flow of information by accepting user input from the view, and
instructs both the model and view to perform actions based on that information
as shown in the following figure.
The
model is responsible for the data management routines in the application. These
are commonly create, read, update, and delete (CRUD) database operations. The
view is responsible for presenting the data from the model, and normally
contains mostly mark-up displayed as web pages, for example RSS feeds.
The
MVC web framework appears 2002, the use of the MVC pattern in web application
design became popular after it was introduced in the spring web development
framework for the java programming language. It was then implemented for the
Ruby programming language in 2006 under the name Ruby on Rails, and later as
Django for the Python programming language; ASP.NET MVC for C#; along with
numerous implementations for PHP. These frameworks have evolved/adapted the
original MVC pattern into slightly different versions to better fit their
concept of application design for the web. Regardless of these variations, they
are still commonly known as MVC web development frameworks.
The
benefits of the MVC pattern in web development are Separating code into
categories such as models, views and controllers, allow the developer to
develop specific areas of project functionality. This will then lead to an
easier to manage, more readable code base, when a part of the application needs
to be fixed, tested, or extended. This is commonly known as separation of
concerns, and if one is working as part of a team, it is especially useful for
separating developer workloads as one can have for example, three developers
working on different areas in the same part of the application –the model, the
view, and the controller.
Client
and Server Interaction within Web Application:
Client/server is a program relationship in which one
program requests another program. Although the client/server architecture
can be used by programs within a single computer, it is a more important
concept for networking.
The basic model of a web
application is same like simple client-server-architecture and includes
browsers, a network, and a web server. Browsers request web pages from the
server. Each page is the mixture of content and instructions expressed with
HTML. Some pages include client side scripts that are interpreted by the
browser.
From
the client’s perspective, the Web page is always an HTML document. The ultimate
result of the client web request processing is an HTML-formatted stream that is
sent back to the requesting client. Business logic is executed in the system
while processing the file. During that time it has the potential to interact
with server side resources such as databases and middle tier components.
Today’s
web servers become better upon this basic design. Current Web servers are much
more security aware, and include features like management of client state on
the server, transaction processing integration, remote administration, and
resource pooling. Web page (or the streamed HTML output of that page) on the
client has a completely different behavior and set of relationships. On the
client, a scripted page has relationships with the browser itself (via the
Document Object Model or DOM).
The
server side aspect of a web page can be mapped with one class and the client
side aspect with another class. A well-known relationship between web pages is
the hyperlink. A hyperlink in a Web application represents an activity path
through the system. This association always starts from a client page and
points to either a client or server side page. Hyperlinks are implemented in
the system as a request for a web page, which are mapped as components in the
Implementation View. A link association to a client page is essentially equivalent
to a link association to the server page that builds the client page. This is
because a link is actually a request for a page.
Client/server
is a computer architecture that divides functions into client (requestor) and
server (provider) subsystems, with standard communication methods/protocols
(such as TCP/IP) to facilitate the sharing of information between them. The
client and server can be identified from one another by the differences in
tasks they perform. The client and server usually operates 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 multiple clients concurrently. Clients always start the dialogue by
requesting a service.
Alternative
Approaches to Web Application:
There are several options for applications
development and all depends on customer needs and requirement. Alternative
approaches to web application development are build either desktop application
or mobile application with same functionality as provided by web application
for the end user.
A standalone/desktop or thick client refers to an
application running on a desktop environment such as windows, Linux or Mac
platforms. The thick client architecture, where the code runs on the client as
well as the processing of data, was once the norm. With the spreading of
internet the thin client model become more popular. The thin client also became
more popular because the standalone applications grew more complex and depended
on third party controls.
Everything has some limitations, and that also
includes thick clients. One of the top arguments against thick clients is when
it comes to deployment. Imagine a thousand clients that must be updated. This
is not an easy task and it takes a lot of time to update all clients. Another
problem with a standalone/desktop application is the platform dependency. A
thick client requires a local runtime environment. For example a Windows form
application will only run on a windows platform with the .Net framework
installed. These limitations are overcomes with the ability to work offline. It
is possible for the application to run offline but it can only work with local
data due to the non-existing internet connection.
There are some factors of an application that is going to be developed
depends on application performance, security, usability, and implementation.
The Web has very rapidly become central to many
applications in diverse areas. As our reliance on Web-based applications
continues to increase and the Web systems supporting these applications become
more complex, there is growing concern about the manner in which the Web-based
systems/applications are created and their quality, integrity and
maintainability. Web performance problem occurs when the web browser request
data from a server that then returns the result, the traffic over the network
can become large. This can lead to congestion which then leads to long transfer
time. And the fact that you get the result from the server means that you
always have to be connected to the internet. Another performance problem lies
on the server. When requesting a page, the server needs to make some
computation. If you have a lot of users making requests at the same time the
server can get heavily loaded.
A thick client provides a lot of functionality which
is not possible on a web application. If we decide to implement a web
application we will have to consider that we will lose some functionality
because of the limitations of the web. The main advantage of a web based
solution is that it is centralized. This has its advantages in easy update and
deployment. Another advantage is that a web application is platform
independent.