Marvel Internet Group blog

Posts Tagged ‘cakephp’

Coding JustRosters - Day 1 - Setting up CakePHP

Wednesday, March 18th, 2009

From this week I will be starting a multi-part series on the coding of JustRosters, touching specifically on the challenges and lessons learnt throughout the experience. Our journey starts on a February afternoon (02/02/2009) at 3pm. The first task that needed to be completed was the installation of a basic CakePHP install.

Installing CakePHP is quite a simple process and simply involves downloading it from the CakePHP page, after a donation, then uploading it on to the server. In our case it is our dedicated U.S. server that will host this application to ensure maximum load capacity and lowest latency for our target demographic. After CakePHP is extracted to a desired location we commit it into version control using Bazaar Version Control (bzr). Bzr is a distributed VCS similar to Git, however it is cross platform and has a much simpler command set.

Once we were able to see the CakePHP default page it was time to analyze the database models. Aulay, being the founder of JustRosters had the best idea of what the application should do and designed the database by himself. My job was to just make sure the table and column names matched the CakePHP conventions so that extra configuration settings would not need to be set on the CakePHP generated models. I also took the time to change any columns whose data types could be improved (int to tinyint) as well as start indexing foreign keys.

With only one hour our project foundation had been laid. Although it is not an exciting event our use of RAD frameworks makes it a much more relaxing process than previous projects where at least a week had to be spent gathering together various pieces of software that managed our database access, email access, templating, etc.

The next post will focus on setting up user registration, validation, as well as user logging in and out. Stay tuned for more.

JustRosters - Rapid development through the use of a company code library

Wednesday, February 11th, 2009

JustRosters is an internal project for us here at Marvel Internet Group. It is a side project that is commercially unproven and therefore a risky investment for the company. With that in mind it is crucial for us to be able to complete the project as quickly as possible in terms of both man hours and actual calendar days. To help us achieve this we decided to comb through our previous work and build a reusable PHP library of our most commonly used functions. This collection of loosely coupled functions allows us to easily enhance any code base; belonging to either a client or Marvel Internet Group.

Our code library is split into three parts. One library contains global functions that are included in Cake PHP’s bootstrap file, which is loaded right after the configuration file and before everything else. We currently place debugging and some custom date/time manipulation functions in here so that it does not have to be duplicated elsewhere. Another part of the library is converted into a Cake PHP component. The custom component allows us to reuse convenience functions that are needed inside our controllers, such as permissions management, emailing with PHPMailer, PDF generation, etc. The remaining parts of our library are turned into a custom helper that performs view related formatting.

In total we have reused about 700 lines of code with the three files combined. Using the general rule of thumb that a programmer will produce about 100 lines of quality code per day we practically shaved seven days off our development time before we even started. The cycle of library building will continue and expand with JustRosters. Being one of our most Javascript heavy projects we are also writing a substantial amount of reusable Javascript code that can be combined into another library, or into jQuery plugins, that can be used by the development community as well as our future clients.

Delivering more for our clients in less time by utilizing the CakePHP framework

Sunday, February 8th, 2009

The process of conceptualizing, designing, and implementing web applications is a complex one. It requires both the client and the development company to come together and share enough domain knowledge to enable constructive communications about the project. To reduce the impact of mis-communicated ideas developers need to be agile, which involves being able to quickly confirm, implement, and get feedback on ideas. Therefore, any tool that helps us reduce the time required to implementing common functionality helps our clients greatly. It is with this in mind that Marvel Internet Group decided to standardize all projects on a development framework. That framework is CakePHP.

CakePHP is a framework started in 2005 that is compatible with PHP, a ubiquitous web development programming language that is used by more than 20 million websites, that follows the “model, view, controller” design pattern. CakePHP allows us to implement client-specific features using common functions that have been heavily tested and debugged by the entire CakePHP community. CakePHP offers polished database abstraction, templating, AJAX, caching, testing, and security features that can be implemented in client applications. Those pre-built features allows us to have a solid foundation from which we can quickly realize our clients’ vision in the form of a working prototype.

The productivity gains that comes with CakePHP would not be so great if a lot of time had to be invested in learning it. That is why CakePHP’s excellent documentation and active developer community means that we can quickly train programmers to become familiar with and productive with CakePHP in a matter weeks.

A real world case demonstrating the benefits of CakePHP comes from our experience with ICEF Online 2.0’s development. For this project we managed to take the version 1.0 program, which was developed without a framework, and re-code it from the ground up with 20+ additional core features in three months using one full time and one part time programmer. The part time programmer had never used CakePHP before and was able to implement our ordering system with less than one week training.

The product delivery time was a great improvement over version 1.0, which took well over six months using the same amount of human resources. We also saw improvement in the size of the code base, shrinking it from 137 megabytes to just under 50 megabytes. With all things being equal we have basically managed to half quoted times in our client application development and create a much higher quality application. This was possible because we were able to focus on what was important to the client, instead of worrying about the low level mechanics of the application.