Creating a web application

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

This document it written as a developers note for a web project. It intents to describe the development process of a real world web-application.

Contents

[edit] Introduction

As I see it there are mainly two ways of building a web application. One is to take the basic tools there is. For example a use a server scripting language maybe some JavaScript, a database and then output xhtml. That is about it nothing more needed. The thing about this approach is that it requires a lot of knowledge and coding, though in the end the app probably is pretty optimized for all the needs specified in the beginning. Then there is another way using some fancy framework or frameworks. This makes building web applications more like programming ordinary desktop apps, like in java or even visual-basic or such alike. Advantages Is rapid development and quite good code organisation at most. Disadvantages is less control of data flow and speed. My approach is something in between. I will use a couple of frameworks, but they mainly is for cleaner code. I want to keep the control for myself and not let it out on some big software hug.

[edit] About Frameworks

When designing an application there may be a discussion of using a so called framework or not. A framework is simply a bunch of functions and/or classes that makes common tasks simpler to do. Though a framework may not always be necessary because if a developer is good at reusing code it might have developed a own small framework of reusable code. Object orientation Example of one page

<?php
        require_once "libs/App.class.php";
 
        $a = new App("index");
        $a->add("menu", "menu.tpl");
        $a->add("content", "index.tpl");
        $a->render("frame.tpl");
 
?>

[edit] Frameworks

[edit] Smarty

The only framework that is really useful for this project is the Smarty template engine. There are a bunch of other frameworks around, but from experience a framework can sure bring all kind of glory and bells and whistles. Though when it comes to performance and such everything depends on the framework, and if something goes wrong you probably do not want to go inside a framework and mess around with the code. The thing is, If you have code it yourself you can also fix it.

[edit] Jquery

Smarty is a way of splitting html-layout from php-logic. Though when an application grows, the need for JavaScript might increase and clutter the html-code. A framework named Jquery might solve this since it separates JavaScript from the html itself. It also simplifies common tasks such as the commonly used ajax-technology.

[edit] How to do ajax with Jquery

A common use of ajax is to load a chunk of html to somewhere on a web page. This may be a problem since xhtml is not that descriptive of the information. Then it is better to load xml information from ajax and transform it to xhtml. Then you have the xml left on the client side to reuse. Therefore minimizing the database calls needed.

Personal tools