Web Application Development and Frameworks Student: Abdullah Mamun (Mamun) Spring 2008 April 18, 2008 Mamun: COMS E6125 1
Introduction Web application and frameworks Exponential growth of human s dependency on World Wide Web (WWW) continues Huge responsibility on a web application developer What to know prior to developing a web application Choose an application framework prior to developing an application Many application frameworks available The framework must be a good fit for an application to be developed A right framework ensures development and performance scalability, robustness, code reuse, reduction of the unwanted events, etc The frameworks bring the guidelines to a developer promoting the best practice Two widely used frameworks for developing a web application are discussed in details and compared The end goal here is to raise the satisfaction level of the WWW users April 18, 2008 Mamun: COMS E6125 2
What to know prior to developing a web application More web applications require programming on both the client side and the server side Complex actions like bank transactions are done using the WWW interface. Secured private network for communication across organizations demands web services Clear documentation based on the features of the application Choosing the scripting language and the application framework The time length develop each feature of the application A project plan outlining the timeline for each and every task A test plan must be carried out to find the bugs, discrepancies and network issues. Windows or Unix/Linux for the web server More convenient to administer a Windows server Unix usually chosen to build a large scale web application for reliability, power and robustness. Build the database first if one is needed. Design the user interface to gain competitive advantage in the industry The user interface must provide visual ease and convenience to the user. In reality a management research work is carried out to layout the user interface design To finalize the positions, style of image, icons, graphics and other elements April 18, 2008 Mamun: COMS E6125 3
Web Application Frameworks A key decision making step on choosing a web application framework Uses the common libraries of database, templates and session management to reduce the overhead Helps developing dynamic websites, web applications and web services On the client side commonly used frameworks: Action Scripts and Java Scripts The Action Script, a scripting language based on Java script is used for developing websites. Two dimensional animations, creation of web based games, web based video and audio The Java Script provides a feature rich framework as it is a dynamic, weekly typed, prototype-based language. Enable scripting access to objects embedded in other applications. On the server side - commonly used frameworks are based on Java, Perl and PHP Most of the Java frameworks are built on the Java Enterprise Edition (Java EE previously known as J2EE) Provides a simpler object oriented model and fewer low level facilities The application can be run on any Java virtual machine regardless of computer architecture. The Perl based framework is widely used to process texts. The PHP (a recursive acronym for Hypertext Preprocessor) based application framework Develop a dynamic web page and it can be embedded into the HTML. Can be used to develop a command line interface or a standalone graphical interface. Two PHP based application frameworks will be briefly discussed, then compared and evaluated April 18, 2008 Mamun: COMS E6125 4
Choosing a web application framework Choosing a web application framework Rule out the application frameworks that do not support the to-be-built web application Find the ones Require less learning Backward compatible on client and servers Weigh the short list of the frameworks using the following variables Scholarly papers, user manual/examples Number of results on Google search on a framework Activity level of the user community on the framework Number of tutorials, forum posts Regular upgrades with stability Other metrics that you can collect Finally choose the framework April 18, 2008 Mamun: COMS E6125 5
CakePHP and CodeIgniter Frameworks Many web application frameworks just based on the PHP language. CakePHP and CodeIgniter frameworks are most commonly used ones. These frameworks will be discussed and compared to give an overall knowledge on the frameworks. The Model-View-Controller (MVC) architecture Needs to be discussed prior to talking about these frameworks. An architectural pattern where the user interface and the data handling can be changed without affecting each other. Adds an intermediate component called controller to enable this capability. Why is the MVC architecture is popular? The web developer does not need to redesign one while modifying the other. Both CakePHP and CodeIgniter support MVC architecture April 18, 2008 Mamun: COMS E6125 6
Open access to the source code of the CakePHP framework. How does CakePHP support MVC architecture? Model represents database and performs the data validation. Less work for a developer The View files are basically HTML files where the PHP code can be embedded. The Controller in the CakePHP does take requests from the WWW users and the servers Parses the requests, apply the logics given by the developer and Interacts with the Models to work with the database and other sources. Finally the Controller sends the necessary data to the View file. Controller performs most of the work as far as I understand. The Cake package CakePHP A Web Application Framework Simple folder structure app, cake, vendors and docs folders. The app folder contains the developers files Scaffolding is available - an extra work load to the developer sometimes. The CakePHP s Model provides relational mapping through associations. The View files can contain HTML, XML, image, etc. Helpers are provided to provide functions in the Views. Repeatable codes such as presentational code are used here as Elements that can be used as a mini-view in other Views. Provides components to include special functionality Enhances reusability by providing library-like-functionality that compiles the business logistics. Supports HTML, AJAX (that requires Java scripts libraries), Java Script, Number, Text, Time helpers Used in the View files to present data in a way that becomes user friendly. Supports Plugins an independent pop-up application Plugins and the main application both share the same configuration such as database connection, etc. April 18, 2008 Mamun: COMS E6125 7
CodeIgniter A Web Application Framework Open source framework and supports MVC architecture as well CodeIgniter highlights: Nearly zero configuration. Does not need to adhere to restrictive coding rules. No need to learn a templating language Offers a separate validation class Plugins are available perform a single function Scaffolding requires keyword for security Capable of managing multiple applications that share a single installation. Easily re-map a URI to point to the right functions. Allows the valid regular expressions. Allows the developer to mix up the wildcard and regular expression routing Many helpers such as URL, Text, Cookie, File Helpers, etc. The names talk themselves about the functions. Not object oriented though. Simple creation and loading of the helpers. Helpers perform multiple functions More Convenience An active Benchmarking class calculates the time difference between any two marked points. The Calendar, Email Class, Language Class, Pagination, Session class, Table. etc classes. Tests can be written for every function of the application using Unit Test class. April 18, 2008 Mamun: COMS E6125 8
CodeIgniter and CakePHP - Comparison and Evaluation Both Supports MVC architecture, open source frameworks Takes URL via routing, translate it to a action/function respectively The helpers, libraries and plugins can be loaded automatically Supports scaffolding CodeIgniter User Manual more user friendly Easy to understand for a beginner A validation class does the validation Provides a Unit Test class to write tests Requires almost no configuration Mix of objects and functions Less coding restrictions Supports regular expressions in routing Scaffolding requires keyword CakePHP Brings more automation Associates all the models Model itself does the data validation Application wide changes can be done at the base application controller Flexible access control lists and flexible View caching Uses objects for core functionality More compliant with MVC architecture April 18, 2008 Mamun: COMS E6125 9
My Takeaway and Conclusion For a small application - CodeIgniter may be a good choice as the learning curve is steep and it is easy to understand There is no straight answer on which one to select for a web application Depends on the developer s comfort zone Eventually transition to CakePHP if possible (that is what I would do) Reading the comparison publications based on date and the authentic sources Tune into changes being made in the frameworks and adapt with the inevitable changes This presentation has tried to guide the web developers to raise the satisfaction level of the WWW users Providing responsibilities of a web developer How to narrow down the choice on application frameworks Familiarity with two application frame works CakePHP and CodeIgniter Guiding on when to transition to a new application framework April 18, 2008 Mamun: COMS E6125 10
Thanks Bibliography Gaedke, Martin, and Joern Rehse. "Supporting Compositional Reuse in Component-Based Web Engineering." The Telecooperation Office (TecO). 2000. University of Karlsruhe. 21 Feb. 2008 <http://www.teco.edu/~gaedke/paper/2000-sac2000- gr.pdf> "Web Application." Wikipedia, the Free Encyclopedia. 23 Feb. 2008 http://en.wikipedia.org/wiki/web_application Fernandes, Caesar. "Web Application Development - a Guide to Success." Sitepoint. 13 Mar. 2003. Animal Show and Sport Network. 23 Feb. 2008 <http://www.sitepoint.com/article/development-guide-success>. "Action Script." Wikipedia, the Free Encyclopedia. 23 Feb. 2008 <http://en.wikipedia.org/wiki/actionscript> "Web Application Framework" Wikipedia, the Free Encyclopedia. 23 Feb. 2008 <http://en.wikipedia.org/wiki/web_application_framework> "Php." Php. 24 Feb. 2008 <http://www.php.net/>. "Java Script." Wikipedia, the Free Encyclopedia. 23 Feb. 2008 http://en.wikipedia.org/wiki/javascript Lavin, Peter. "Object Oriented Php: Concepts, Techniques, and Code." Google Book Search. 24 Feb. 2008 <http://books.google.com>. "Sun Developer Network." Sun Developer Network. 24 Feb. 2008 http://developers.sun.com "The Perl Dictionary At Perl.Org." The Perl Dictionary At Perl.Org. 24 Feb. 2008 <http://www.perl.org/>. "PHP MVC Frameworks" PHP Frameworks 10 Mar. 2008 <http://www.phpwact.org/php/mvc_frameworks> Shared Hosting DEVSHED 12 Mar. 2008 <http://www.devshed.com/shared-hosting> Taking a look at ten different PHP frameworks PHPit 12 Mar. 2008 http://www.phpit.net/article/ten-different-php-frameworks/ Choosing a framework for web development Web Pro News 10 Mar. 2008 <http://www.webpronews.com/expertarticles/2006/12/04/choosing-a-framework-for-web-development> "Cake PHP" Cake PHP 10 Mar. 2008 <http://www.cakephp.org/> Code Igniter" Code Igniter 10 Mar. 2008 <http://codeigniter.com/> "Code Igniter VS. Cake PHP" Code Igniter vs. Cake PHP 10 Mar. 2008 <http://snook.ca/archives/php/codeigniter_vs_cakephp/> "Web Application." Wikipedia, the Free Encyclopedia. 23 Feb. 2008 http://en.wikipedia.org/wiki/web_application "Php." Php. 24 Feb. 2008 <http://www.php.net/> April 18, 2008 Mamun: COMS E6125 11