This was one of the most challenging projects I have developed. The development process took me about four months and involved a wide array of technologies: Perl, CSS, JavaScript, Flash and MySQL.
Project Layout
The client owns one of the biggest adult personal ads website in Mexico. By the time he contacted me, his users made all communications directly using mostly free email services -as Hotmail, Yahoo, Google, etc.- which sometimes suffer exploit attacks. He wanted to change this as he wanted to give more features and ease in his user's private contacts.
The idea was to design and develop an internal messaging system that will be used to communicate among users, instead of doing it directly by other email services. The main features the client wanted included in such a system were:
- Password protected account to each user from which he or she could check their sent and received messages sent with a mail inbox look.
- Advanced message composing (font style, icons, etc).
- Personal image and video gallery (not as attachments but viewable in realtime).
- E-mail confirmation of messages sent and received.
- Must work without changing the existing user personal ad database.
The last point was the most important. The client had an existing database system with all his users personal ads. These ads were at that time browsed by his active users, displaying then the email address of the actual ad. The migration to the new system I was developing, was to be made seamlessly to the existing database without any inconvenience for the users.
Application Internals
Database
With the layout set by the client himself, it was time for me to start planning the system. My first task was to analyze the existing ad database my client had, so I could come up with a way to integrate it without changing a thing.
The already existing database was stored in MySQL and each personal ad had it record with its unique id and email; this gave me a great advantage, since enabled me to associate the ad with the message by id.
The new messaging system will be driven by a MySQL database with 7 tables.
- Accounts Table: This holds the main configuration for each user account, including the associated username, account password, and some other specific configurations.
- Emails Table: Each user could use more than one pre-existing email address in which he would receive notification of any arriving new message in the system. Was then necessary to create a separate table for those email addresses, so any account could have different pre-existing emails associated to them.
- Usergroup Table: I provided the possibility for our client to create different usergroups with different privileges, like storing space and max amount of messages. Each account has one usergroup that sets all the privileges.
- Messages Table: This table holds all the messages in the system. I created several indexes on this table for a faster access.
- Images and Videos Tables: Both of these tables have all the related information on the uploaded images and videos.
- Albums Table: I added a nifty feature that the client didn't think of. The users would be able to create albums with their images. This way, they could categorize their images and share their albums. The users just loved it and the client was ecstatic!
Framework
The core application was coded entirely in Perl. The framework I used was CGI::Application.
One of the main reasons for this decision is that I wanted to make the application very easy to expand, so working with the CGI::Application framework gave me the opportunity to make a base application and then attach plugins to it.
Once I had the base application, I started to create these "plugins"; eg. the album plugin, image upload plugin, video plugin, etc.
In the end I ended with a very robust application that was easy to update and expand.
Templates
Design maintainability was a major concern of the client. He wanted his designers to easily change the look and feel of the application without the need to make changes in the source code.
Obviously I needed to use templates to completely separate the things that changes (design) from the thing that shouldn't change (source code). My first choice for this was HTML::Template, because it integrated seamlessly to the current framework and because it's very easy to use from a designer standpoint.
Sessions
I created my own session management module using Cache::FileCache for session storing and Digest::MD5 for the data serialization.
Debugging and Error Management
The framework I used made it very easy to catch all errors generated by the application. I wanted it to be very easy to catch and identify errors on the application.
When an error arises, a complete report is issued and emailed directly to the site's administrator.
Application Front
Aside from the core application development, I was also in charge of the general design layout of the application.
My main goal was to deliver a clean interface that was practical and very easy to use by the client's users.
For this purpose, I avail myself with technologies like JavaScript and AJAX; also I made heavy use of CSS and some Flash apps.
Application login (shown in its original Spanish)
Advanced text editor with font style selection and emoticons
Image upload using a Flash application which enables multiple file upload with one action
|