Practical Object-Oriented Models in SQL

Bill Karwin

SQL is from Mars, Objects are from Venus. This talk is for software developers who know SQL but are stuck trying to implement common object-oriented structures in an SQL database. Polymorphism: Suppose your blog supports comments, but then your comments need to reference multiple types of content, for example news, blog articles, and videos. What then? Extensibility: We’ve all designed customizable software, allowing customers to extend a data model with new data attributes. See how to design flexible systems, while using efficient SQL queries. Hierarchies: Tree-structured data relationships are common, but working with trees in SQL usually implies recursive queries. There are a few solutions to solve this more cleanly, including Common Table Expressions in PostgreSQL 8.4. ActiveRecord Dos and Dont’s: Web development frameworks have popularized the use of design patterns, but when it comes to multi-table queries, complex views, and assignment of OO responsibilities, ActiveRecord falls short as a one-size-fits-all Domain Model.




Slides are available at: