Monday, September 21, 2009

Dr. StrangeFramework or how I learned to stop worrying and love the layers

Part 5 – ORM
What is it? I don’t think there’s any definitive answer, but basically ORM (Object Relational Mapping) abstracts data into objects (or attempts to) – so multiple tables providing data to represent a single project is treated as a single object with in the code: project name, project tasks, project notes, etc. each stored separately in the database (RDBMS) becomes a set of related objects within the PHP code…what my hope was, was that DataMapper would provide the interface to define the data layer and then kick back a hierarchical single object (Project) that would provide methods to access the underlying related data (project notes, etc.)…well, it did make accessing and manipulating the data easier – the top-down object hope was not there (could be my misunderstanding of ORM OR the difficulty in providing it). Once again following a framework forced me to setup the various data tables in a standard format and it did handle all of the underlying SQL/DB requirements and probably reduced my code by half (at least). Without having a LARGE database, its difficult for me to say what the performance impact is…I would assume there’s some impact…but I’ll leave that to others to provide the insight on…next, wrapping up

No comments:

Post a Comment