Bookmark and Share

Saturday, February 27, 2010

Mapping an Object Interface to Relational Data

Introduction

Storage of data as well as access to data in RawDev is facilitate by the data aspect or model (such as in MVC). The model is divided into three separate layers. The first layer organizes raw data into uniform entities and relations. The second layer adds security to the data by providing a mechanism to define access to data and enforcing these rules. The third layer maps entities and relationships to an object oriented interface which makes it easy to deal with nested structures and apply business logic using object oriented programming constructs.



The layers in the RawDev model (the data aspect)

Relational DataAccess ControlsObject Interface
Entities, RelationshipsUsers, Groups, RolesNested Data Structures
SQL (across data sources)Authenticated Sessionsadditional Business Logic
XML Data DefinitionRow/Column Level Access 
Caching, Copying, SynchronizingLogging 
 LDAP Integration? 
Overview of the three layers

Relational Data


Chances are that you primarily use a relational database such as MySql to store your data. RawDev provides uniform access to your favorite relational database as well as any other data source. Access to other data sources is handled by plugins. You can write a simple plugin that lists the files in the file system or hooks into an online data feed. After defining the structure of your data source in XML (think create table) you can access it and join it to any other data source using regular SQL. In addition, RawDev will provide mechanisms to cache data locally, copy entire data sets as well as synchronize data.

SELECT b.url, b.title, p.latest_post, a.ranking
FROM mysql:blog b, rss:posts p, alexa:ranking a
WHERE b.url=p.url and b.domain=a.domain
Example of a join across data sources listing 10 locally stored blog urls with their latest post and the alexa ranking on the blog domain.

Access Controls


RawDev has powerful ways to provide data access to users . RawDev provides tools to manage users, roles, organizational groups, and provide a powerful interface to grant privileges to these entities. RawDev maps and enforces these privileges in the back-end (e.g. read/write, entity, row level, and column level access). Individual users access the data using authenticated sessions. Optionally, access is reported in a central log. It is on my wishlist to provide LDAP integration (after the summer).

Object Interface


The third layer maps the relational structure to an object interface. In this layer, RawDev provides additional data access tools as well as the ability for programmers to extend this. For example: say a user profile consists of many entities such as degrees, languages etc. Using this layer you have powerful tools to save the entire profile with little effort, updating only the child records that were actually changed. Further more, additional business logic can be implemented in this layer. As simple as a uniform way to display full names or as complex as the order in which records across entities can be stored given a specific business process.




Storing a form with a nested data structure becomes a piece of cake in the RawDev Object Interface.

When do I have access to this?


Although the existing production applications such as Find a Psychologist and Fodius.com enjoy significant parts of the RawDev model, the open source version is estimated to have the full model functionality in the summer of 2010.

Philadelphia,
Raymond Bokenkamp.



Raymond Bokenkamp, MBA, MS is the founder of Bokenkamp Consulting. He holds a Masters degrees in Computer Science from the University of Twente in the Netherlands as well as an MBA from LeBow School of Business, Drexel University. Raymond has over ten years in developing programming frameworks in academic settings as well as private companies. This year he decided to release his framework RawDev as open source. RawDev is a balanced approach to sustainable programming in PHP. He started his first company in 1991, a screen-printing business, which is still thriving today and recently expanded from the Netherlands to Poland. He is now bringing his entrepreneurial spirit to provide web solutions that make a difference. Raymond loves to do yoga, write blog posts, compete in city chases, and hike in the Wissahickon Park in Philadelphia with his wife, Lisa, and dog, Jax.

No comments:

Post a Comment