Saturday, November 28, 2009

Significant Changes & Code Update


Today I uploaded a fresh copy of the source code. This source is significantly different from the last commit and as a result many blocks were removed from the source. The framework SVN repository contains only the few base files needed for Wax to function properly. Some of the major changes are listed below:
Added include/ directory to block dirs
This change allows 3rd party libraries to be included with blocks. Previously, this was done through the blockname.wax/lib directory, however, this directory's purpose has changed.
Changed purpose of lib/
The lib/ folder now contains role-playing objects exposed to the rest of the runtime. Examples include Controllers, Models, and libraries.
Added blocks/ directory to block dirs
Blocks can now auto-include dependencies by putting them in the blocks/ subdirectory. This is especially useful for the new Application structure, explained below.
Applications are now simple blocks
Applications are now exactly the same as a regular Wax block, but with the addition of init.php and index.php-- the two files required to make a block executable. Applications can bundle their own dependencies and libraries using the new blocks/ subdirectory.
Added Exception Handling to the Core
Previously, Wax did not use Exceptions and used manual error catching. As the framework matured it was clear this wouldn't scale as easily as adding a global Exception handler. As a result, the WaxException class was added and the wax_exception_handler() and wax_error_handler() functions were added to core/include/exceptions.php Many roles were also rewritten to use Exception handling as opposed to simple manual error catching.
TypeHinting now Discouraged
Using TypeHinting in roles was encouraged up until now, when a significant conflict was discovered. When using the AddRole method after instantiation, the list of implemented interfaces is not modified. As a result, PHP doesn't know that the object now plays the new Role and the TypeHint will fail when calling a Role method. TypeHinting also is not the quickest feature in PHP, so its removal should result in a (very) slight performance gain. To replace TypeHinting, Exceptions are now thrown in the case of an Object/Role mismatch.

Saturday, November 14, 2009

Close to a release

With the semester coming to an end and the framework maturing, I feel confident that by the end of the semester I'll have a working framework capable of creating simple websites. The initial release will require an installation of either CouchDB or MySQL for the database. Unfortunately, due to the vast difference between database systems, I can't guarantee the ability to switch between them once an application has been written. To put it simply, if you write an app using CouchDB, you'll have to restructure the entire application to make it work with MySQL. I'm currently looking into the reverse, which may be possible (Port MySQL to CouchDB).

Some of the basic blocks planned for inclusion are:
  • webcore: responsible for MVC roles, default Wax theme
  • couchdb: handles interaction with CouchDB
  • mysql: handles interaction with MySQL
  • msgbox: provides library for displaying different types of messages
  • html: library for rendering different types of HTML controls, including forms
  • form: extended library for handling forms, including file uploads