CIMSU OTS Technical Blog

Saturday, February 10, 2007

Background Info

As this is supposed to be a partial record of the development of the OTS, I feel some background is in order.

The system runs in PHP5.1 (previously 4.3) with a MySQL 3.21 backend on Redhat Linux on an IBM Blade Server. The update to PHP5 has allowed me to begin work on a much more advanced backbone which I'm calling OTS2 for now.

Originally, the OTS ran on an object-oriented backbone, called FrameWorks, I designed as an abstraction of several important functions I'd been using, such as user authentication and database access. But as the needs of the project developed, it became relatively obvious how limited this system was. It was also a huge performance problem, as it relied on an object-inheritance tree. (There was a root object called "Object" which did nothing but figure out the name of the class and generate a microtime stamp.)

Currently, most of the system still runs on FrameWorks 1.0CI, the original implementation of FrameWorks, adapted for the Confucius Institute (basically downgraded to run in PHP4). However, as I update the functionality of the site, I am slowly transitioning to FrameWorks 2.0beta, a strictly PHP5 update of the previous version. Features of PHP5 that are heavily incorporated in FrameWorks 2 are more advanced error handling via PHP's new Exception structure--user-friendly error messages instead of simple "die();" statements--and the new OOP structures, such as static methods and variables and scope resolution.

The first part to be rewritten as part of FrameWorks 2 was the Calendar system. Obviously, OTS relies on a lot of calendar functions to schedule appointments. FrameWorks 1 didn't even have a Calendar object, so OTS had several pages creating their own, simple "calendars." This took a lot of code, and changing the calendars involved changing the code in all of them. They were also formatted with tables and just generally unpleasant. So I created a new OO system in which a Calendar object stores all sorts of things, including user and server timezone offsets--important when half the users are in China and the other half are in the US--and deals in "Events," which are ordered based on their beginning timestamp. The Calendar can then output a CSS-formatted calendar (all DIVs instead of tables) which can show a day, a week, a month, a work-week, or the next 4 days. Incorporating this reduced some of the code by as much as 80% and unified the system so that changes are now made to one object instead of three or four pages.

The OTS is built, too heavily, on AJAX. This has caused me nothing but headaches since I made the decision. When I started the system, I had just discovered AJAX and how to make it work... I hadn't yet discovered when to make it work. Certain parts of the site benefit from the AJAX framework--the "announcements" system, for instance, which can count down to your next appointment--but the rest suffers. A lot. AJAX is a great methodology for things that actually need to update regularly without page reloads, but it's far too rigid for real page-to-page navigation. Either you end up with hundreds of individual JavaScript functions (like I have) or you simply can't do certain things (also, like I can't), like easily submitting forms. The number of cheap hacks and "workarounds" I've done has made maintenance on the system virtually impossible.

Finally, the real meat of the OTS is a Flash Communications Server. Honestly, I have almost nothing to do with this. We already had the necessary SWF files and just plugged it in. It allows full-duplex audio conferencing along with both English and Simplified Chinese text chat. In these "rooms," tutors and students get together and the actual learning takes place. Lately the only work I've done on this is try to fix the way sessions end and take users to rating pages (stupid AJAX).

That's basically where we stand now. I'll post some more info about the changes I'm working on shortly.

0 Comments:

Post a Comment

<< Home