
Crossing the language barrier with Perl
The stability and flexibility of Perl makes it a fantastic asset in rapid application development, but often a project requires components in several different languages. These might include client-side javascript, mobile apps on Android/iOS, or desktop applications for which C or C++ may be a better fit. Fortunately, Perl makes it easy to apply abstract model definitions to other contexts, and EntityModel provides a framework for doing just that.
The base EntityModel distribution provides a data storage abstraction system (in the form of an Object Relational Model) for accessing backend storage from Perl and other languages. The intent is to take a model definition and generate or update database tables, caching layer and the corresponding code (Perl/C++/JS/Python etc.) for accessing data.
The model definition itself is extensible, allowing more than just a data model: current extensions include
- abstract user interface definition which can generate command-line, html/js web interface, Android or Tickit layouts from a single source
- routing and page specification for websites or equivalent applications
- automatic REST/SOAP/JSON-RPC/XML-RPC interface generation
- query abstraction allowing conversion to/from raw SQL
On the Perl side of the EntityModel framework:
- Event-based approach - reads and writes are handled through callbacks, so the code can continue with other tasks while waiting for backend storage to respond; modules such as Net::Async::PostgreSQL allow for asynchronous ORM access
- Modify database schema without changing code - configuration is stored in formats such as JSON or XML allowing them to be changed without altering any of the core application code
- Dynamic code generation - the class structure can be generated dynamically from the configuration, so your modules only need to contain whatever custom methods or application logic you need
- Schema can be applied to a variety of database backends - switching between databases is typically a transparent process, involving only a single change to the schema loading step
- Graph-based editor - entities and relationships can be modified visually rather than having to edit the config file directly
- Support for caching - simple RAM cache, memcached and other caching models can be applied