Recently, after exactly one year from the beginning of my flirt with this nice mapping application, I started to code on MapStorer again.
This time, I’ve been asked by the original authors to implement the long awaited mapfile import function. Because of me being the mind and the arm behind the new plugin system, I was the natural choice for the import plugin writing.
Talking about this import plugin, it is now almost complete in its first step, mapfile parsing, while I’m in the process of writing the persistance layer. After a few unsuccessfull tests, I decided not ot use php_mapscript for mapfile parsing, both direct import into a map object and the tokenizer had too many drawbacks, so I went for writing another regular expression parser again.
We discussed several times about how to make MapStorer code more maintainable, the actual code is a real mess, no structure, no patterns (not even a simple front controller), no functions!!! A maintainance nightmare. Finally, after the MDB2 DB abstraction layer I introduced a few months ago, we decided to implement an ORM (Object Relational Mapping). We decided to use PEAR’s DB_DataObject since it plays well with other PEAR packages and it’s very well documented and maintained. After a few troubles with the differences between MySQL and PostgreSQL versions, I’ve managed to implement this ORM almost completely, as usual I wrote several unit tests for the new code: I felt in love with test-driven programming long ago and never turned back.