Pylons Service-Oriented Architecture

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Abstract

Thoughts on organizing Pylons code in accordance with the principles of Service-Oriented Architecture.

Data Layer

Using SQLAlchemy provides a very nice data layer for free. However, you really can't rely on the objects that SQLAlchemy provides. As the database changes, or even as you change your database, these objects will change. You need an abstraction layer on top of the data layer.

I stick all of the model stuff---the SQLAlchemy tables and objects and mapper calls---in files under myproject/data. Each file has, pretty much, one table and one object described within.

When the services begin to be pulled out of the web application, these files will leave with it. In the end, the web app will have no access to any database, only addresses to the various services it is looking for.

Business Logic

The business logic lives under myproject/svc. These are the rest of the services that we use.

These are modules that provide very specific and discreet atomic actions. These methods, in turn, call out to the data layer.