A First Look at Atlas – the ORM That Delivers
“AtlasORM is a data mapper implementation for your persistence model (not your domain model)”
By definition, a Data Mapper moves data between objects and a database and isolates them from one another. With a Data Mapper, the in memory objects don’t even need to know that a database exists. It does not need to know the SQL interface or database schema; it doesn’t even need the domain layer to know it exists!
This might lead us to thinking that, in Atlas, the persistence layer is totally disconnected from the database, but that is not quite what happens. Atlas uses the term
Record to indicate that its objects are not domain entities. An Atlas Record is passive; not an active record. Unlike most ORMs, its objects represent the persistence model, not the domain model. Think of it as representing how the data is stored and not as real world representations.
What’s the reasoning behind it?
The creator of Atlas, Paul Jones, based it on this article from Mehdi Khalili. The idea was to create an alternative to the Active Record pattern (an object that carries both data and behavior, and is intrinsically connected to the database).
Citing the author:
“I wanted an alternative to Active Record that would allow you to get started about as easily as [with] Active Record for your persistence model, and then refactor more easily towards a richer domain model as needed.”
Altas has its own set of characteristics that differentiates it from others.
- No annotations – Under the premise that the code should be in the code and not in the comments.
- No migrations or database modification logic – Since Atlas is decoupled from the database (not entirely, the package, as a whole, needs to interact with the database to be able to move data back and forth), it makes sense that it only acts as a model of the schema and not has a creator and manager of it.
- No lazy-loading – The creator thought of lazy loading as being useful, but ultimately too much trouble for what it is worth.
- No data type abstractions – The database types are exposed and available where possible.
- Composite key support – Atlas supports both composite primary keys and composite foreign keys.
Now that we have a general idea of Atlas and what it stands for, let’s have a look at it in use.
Continue reading %A First Look at Atlas – the ORM That Delivers%
LEAVE A REPLY
You must be logged in to post a comment.