Problems of Web Application Programming and the
GGF Approach
Many web developers may not even be aware of it, but the usual model to implement web applications, is rather unstructured. In many cases cohesion is low because capturing input (sending an HTML document with a <form> and processing the input in the form-action document are implemented in different files. From the outside it is not visible, what belongs together. In HTML there is no concept of modal dialogs, message-boxes and non-modal windows as we have it in the GUI world. As a result, every site is different to navigate and some of them are rather inefficient to use. Some would say, we can do all this in Javascript, but for security reasons, that may not be an option in every case.
The GGF approach
This is very simple. We tried to transfer GUI programming style to the web. As far as possible.
We also tried to apply good OO-design practices. In an GGF application every page (=window) of the application is implemented by a single PHP class, that is stored in a single file. All HTTP-requests from buttons or hyperlinks on that window are regarded as callbacks to the window itself (its PHP class). They trigger actions on the window’s content (the model) and are handled by the same PHP class (by event/action functions).
The following (simplified) diagram shows how it works.

Every window class in GGF has an open function that is responsible for rendering the windows contents (creating HTML output) . All hyperlinks and buttons refer to that same PHP-file. The class will process a click on the Login hyperlink with their eventLogin function. The function will then call the open function of the GGFLoginDialog class to open a login dialog. There again the click on the OK button will send a HTTP request to the eventOK function of the GGFLoginDialog.php class. GGF session handling will allow to return from the login dialog to the mainwindow, supplying the mainwindow with the results of the dialog. Visit the demo to see how it works.
GGF implements the concept of a window and a (modal) dialog.
· Windows are just HTML documents that have a menu of so called callback links. These are hyperlinks to URLs that are handled by the window’s class.
·
Dialogs are also HTML documents. But they usually have
a form and buttons (OK, Cancel) and they must be linked to a parent-window. GGF
takes care, that the parent-window automatically is re-activated, when the
dialog is finished (by pressing OK or Cancel).
GGF implements also the following concepts
· A persistent context object allows to reopen windows with their previous data
· Reusable functions allow the context switch between windows and dialogs
· A singleton database object takes care of things like nested transactions
· Three trace levels help to find out, what goes on
·
An error-stack simplifies error-handling
Every GGF application consists of at least one window class and can have several dialog classes. Currently the concept of modal dialogs is implemented in a very simple, but working although not too nice-looking way. When a dialog is opened, it just replaces the parent window. So nobody can enter data into the parent window as long as the dialog is active (as it is the case with modal GUI dialogs). When the dialog closes, the window is redisplayed automatically and then available to receive any request. For more on this see the getting started guide (300 KB pdf).
GGF is implemented, using PHP5, MySQL and HTML. It is tested under APACHE . It uses only pure HTML at the client (no Javascript, no Applets are needed).
Note: In the GGF
project we do not concentrate on graphical design, but on the inner values of
OO design. We know, that everybody with a good knowledge of HTML or Javascript
may be able to improve the design of the sample windows and dialogs quickly.
But GGF will take care that everything fits together and is maintainable over a
long time.
Comparing GGF with other PHP Frameworks
We think GGF is good, but it depends on your needs if it’s the best for you. We cannot describe every available PHP framework here, but the following chart should give you a first idea, if GGF may fit to your needs:
Framework Comparison Chart (by Dennis Pallet)
Based on his categories GGF would compare as follows:
|
Framework |
PHP4 |
PHP5 |
MVC |
Multiple DB’s |
ORM |
DB
Objects |
Templates |
Caching |
Validation |
Ajax |
Auth Module |
Modules |
|
GGF Framework |
n |
y |
y |
n |
y* |
y |
n |
n** |
y |
n*** |
y |
y**** |
* GGF does not use the object-relational mapping concept but uses an Entity Relationship Model (meta model approach) to generate SQL, describe object structures and relationships. We think that performs better and is easier to use.
** GGF has no built-in cache but works well with APC (advanced PHP cache)
*** GGF allows creating good GUI’s without relying on Javascript
**** Query objects, Window and GUI control objects with dynamic HTML Generator, filter and sorter objects with Editors, SQL Generator. Mode Generator tool (creates CRUD applications from database tables).