-
Notifications
You must be signed in to change notification settings - Fork 36
DevGuide PerlObjects
Melody offers a robust system for managing application and user defined data. The primary interface to this system is through the base class MT::Object, which all other objects derive from.
Because all objects inherit from the MT::Object base class that means that all objects will automatically support the following features and behaviors:
-
the methods
new
,load
,save
,remove
andremove_all
are defined automatically -
all objects will be cached in memcached when properly enabled
-
callbacks into the creation and editing of objects are defined
-
support for storage of that object across all supported databases, including mysql, postgres, SQL Server, Oracle and SQLite
-
upgrades and changes to the underlying database schema are completely automated
Melody Objects actually know nothing at all about how they are stored. They simply know about the data they represent. Melody's data abstraction layer takes care of all of the SQL and database specific issues for you.
In Melody, developers never have to write SQL.
For the geeks out there let us take a quick diversion to give ourselves a little background on Melody's data abstraction layer. This layer is what allows developers to store and retrieve all manner of data to and from the database without ever needing to know or understand SQL. It is also what makes it possible for Melody to automate database upgrades and easily support multiple databases without developers having to grapple with the idiosyncratic differences between them.
There are a number of key classes that make up this framework, they are:
-
MT::Object - the base class from which all other objects derive. Each MT::Object defines the data model for that specific object.
-
MT::ObjectDriver - a thin wrapper around the core underlying data abstraction backend called Data::ObjectDriver. This is maintained for backwards compatibility.
-
Data::ObjectDriver - an open source data abstraction layer for Perl applications. This is where most of the work is done and is what is primarily responsible for converting API calls to SQL statements. It also provides support for memcached and other low level database features like partitioning (a feature planned for a future release).
- MDG: Manipulating Objects - Saving, Loading and Deleting Data
- MDG: Creating "Junkable" Objects
- MDG: Building Scorable Objects
- MDG: Creating Revisionable Objects
- MDG: Building Taggable Objects
Questions, comments, can't find something? Let us know at our community outpost on Get Satisfaction.
- Author: Byrne Reese
- Edited by: Violet Bliss Dietz