Web Application Primer - Introduction

March 19th, 2007 : Austin Smith

Greetings, new readers. My name is Austin and I’m a developer here at ArcStone. Most frequently I develop in PHP, but I have also done web application development in Java, Ruby [on Rails], Perl, Python, and other sorts of development in C#, C, C++, and Tcl/Tk. This series of articles will attempt to explain the technically complex (and thus often misunderstood) parts of my job for the non-technical or less-technical readers. This is a good place to start if you’re curious about what web application development is like, and more importantly, what it’s like to work with ArcStone to develop your web application.

One of my favorite parts of my job is the theoretical thinking about an application that starts well before the first line of code is written and continues into development, yet I find that the architecture and theory behind webapps is one of the least understood aspects of what we do and thus one of the most frequently ignored–clients want fast results, time is limited, and it’s hard to justify a thorough job in a poorly understood area. Still, my experience has shown me that paying attention to the details, drawing pictures, and minding some of the rules and conventions of development will yield better results in the long run.

The pieces of a web application

The database.To me, this is the meat of the application. Imagine, if you will, a library–full of books, periodicals, and reference materials. The larger the project, the larger the library. The database is your project’s library, and the application is its reader. Some databases have multiple readers, but not all. For example, a bank’s database might have several readers–its internet application, ATM software, credit card processing software, and the software that tellers at banks might use.

The business logic. We often call this, along with the database, the “model” layer of the application. This core functionality can be seen of as a set of generic descriptions. Let’s say you have a library with a section where user data is stored. It’s easy enough to fetch the data, so long as your library is up to par, but the point of the model is to describe useful things that can be done with the data and provide reusable ways to do these things. An example would be to check out a user from the library, change its password, and tell the library to stock the new version and shred the old. Of course, this is a basic example. I like to load the bulk of my applications’ code in the business logic, because once it’s written here, you should be able to use it anywhere in your applications that share the same business logic.

The controllers. These are the masters of your application, and far too often they are burdened with the additional tasks of the model. The controllers are the arbiters of the models, the link between what the computer user sees and what happens in the database. Want to log in? Ask the controller, it’ll dispatch your request to the appropriate model and then handle the response from the model and dish it back to you in readable English (wrong password, jack). When a controller is burdened with the work of the model, a key component of quality applications goes out the window. An application with 50 web pages might have 50 controllers, and each controller probably does something similar to at least one other. Effective controllers are dependent on effective models.

The view. This is your application’s face, what your users see; the view by itself is often what your average Internet user might describe as the entirety of a web site, so it shouldn’t be too hard to grasp what the view does–output things to the screen. As important as it is that the controller not do the model’s work, it is perhaps more important that the view not do the controller’s work or the model’s work. Placing requests for information from the database alongside instructions to display the web page is a recipe for disaster. Not only will changes to the database totally wreck the controller, it will probably also take out the view. An application that has a database layer and a view layer with nothing in between would need to be completely rewritten in the event that something changes. That’s a developer’s nightmare, and why I do my best to adequately plan applications for inevitable changes.

Database, model, view, controller. These are the parts of a fully formed web application; everything else can be expressed as relationships between the two.

Next in this series: The Dictator and the Database

Tags:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • Reddit
  • Slashdot
  • Technorati

5 Responses to:
“Web Application Primer - Introduction”

  1. a gravatarJess Louwagie

    I challenge your point #1 and propose that #4 may be the most important part :)

  2. a gravatardcarnes

    I actually agree with Jess about the view - and I don’t think he disagrees ’cause he’s a designer and you’re a coder - he may be onto something. Isn’t the utility, the usability the most important part? When thinking about a web application the output and desired behavior is the starting point - then the implementation, database, code, etc. follows. We talk about and work a lot with blue printing web apps - is this part of the model?

    On another note - a question - are there any great web sites that have no database, controllers, etc?

  3. a gravatarAustin Smith

    Usability and even interface should be organic in a web application from the model up and when you talk about concern for these things, you should certainly not limit the scope of your concern to the presentation layer. While your point is of course is well taken that the view is what the user actually interacts with, a site built on a poor model is like a house built on a termite-ridden foundation. It may not kill you today, but you will pay for it eventually. An application built on a solid, normalized database will not only perform faster than one which is not, but the one with the normalized database will allow for the sort of graceful development in which each subsequent unfolds from the previous.

  4. a gravatarBart Gottschalk

    Ah, the great debate about which layer or aspect of a web application is the most important. I believe the layer that is most important depends on the requirements of the application. Some business situations are driven by data (data base/model), some by integration (model) and others by the user experience (view). If any of these considerations are not given appropriate attention (and appropriate is different for every project) the resulting application will not be able to grow and change to meet the ever changing demands of the owners and users.

  5. a gravatarTechnology Translated » Blog Archive » Web Application Primer - The Dictator and the Database

    […] back to my unauthorized look into the seedy underbelly of a web application. (did you miss part one?) Today: the database. The model. The schema. The sick, twisted, gang of data that lurks beneath the […]


Leave a Reply:

Subscribe without commenting