The Data Mapper (selector) layer

The following is Martin Fowler's definition of the Data Mapper layer (http://martinfowler.com/eaaCatalog/dataMapper.html):

"A layer of Mappers (473) that moves data between objects and a database while keeping them independent of each other and the mapper itself."

Making effective use of database queries to fetch data is as important on Force.com as any other platform. For complex object models, having SOQL do some of the heavy lifting can lead to some fairly sophisticated queries. Encapsulating how data from the database is mapped into memory is the role of the Data Mapper layer.

In Martin Fowler's world, this usually involves mapping database result set records returned in Java classes (known as Plain Old Java Objects (POJO) or Data Transformation Objects (DTO)). However, Apex provides us with these data structures for each of our Custom Objects in the form of SObject. Thus, the role of this pattern is slightly different, as the SOQL query itself explicitly selects SObject fields representing the data. Hence, this pattern has been renamed to reflect its key responsibility more accurately.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.61.30