Dynamic web page creation needs a convenient and powerful server-side web framework. It is slow and difficult to create a functional and appealing dynamic web application using the legacy CGI protocol. Its interface is too low level and it provides little assistance to manipulate server-side data, render UI elements, and manage Ajax interactions.
Appweb provides a rich set of options to use when creating web pages or web applications. This document compares the alternatives and suggests where each option is best deployed.
Embedded Server Pages
ESP is a new web framework that provides templates, caching, Model-View-Controller paradigm, and a set of web controls that are pre-integrated with jQuery. ESP uses "C" language code embedded in web pages for native-speed execution. It is fast and compact. For more information, please read Using ESP.
The action handler is a simple Appweb request handler that maps URIs to C functions. It does not provide any other infrastructure or capabilities other than those offered by the Appweb APIs. Action routines are very fast, as there is very little code run before invoking the action. The action handler is ideal for simple bindings from URI to C code.
Ejscript is not as small as ESP, nor as fast, but it is a very powerful web framework. It is good for embedded web interfaces and async communications services where sufficient memory is available. For more information, please read Using Ejscript.
PHP is a widely-used general-purpose scripting language that is especially suited for enterprise Web development. It provides an object-oriented programming language, numerous extensions and a broad developer community. The power of PHP comes at a price, it typically has a memory footprint of more than 5 MB for the PHP code alone. For embedded systems, this is often too big and so we recommend using ESP instead. For more information, please read Using PHP.
Common Gateway Interface (CGI)
CGI stands for the Common Gateway Interface and it is the legacy extension interface for running external programs to generate dynamic data. It is standard but slow. Unless you have legacy CGI programs or need to run a scripting language via CGI, you are better served by using either ESP or Ejscript. For more information, please read Using CGI.
For embedded devices and applications: we recommend using ESP. It provides the fastest, most compact web framework without compromising on functionality. Use Ejscript for large applications that have more memory available for execution.
The following table may help summarize the differences:
|Target Use||Have existing CGI program||Simple C functions to serve content||Web user interfaces, comms services||Dynamic embedded web pages and forms||Enterprise web pages and forms|
|Memory (excluding core Appweb)||External program||5K||200K plus app code||1MB plus app code||10-50MB plus app code|
|Performance||Slow||Fast||Fast||Medium speed||Medium speed but large memory consumption|
|Advantages||Standard in wide-use||Simple, fast processing||Powerful for creating C-based web applications||Fast, compact and flexible||Large base of PHP code and developers|
|Disadvantages||Slow. Limit to forms. Can't design page WYSIWYG||No web templates or higher-level functionality||Limited by the capabilities of the C language||Scripting, so slower than C||Large memory footprint|