Skip to content

Notes on V3 Architecture

Rizwan Reza edited this page Dec 9, 2016 · 8 revisions

Due to the complexity of heavily metaprogrammed systems, the CAPI team decided to follow a set of simple repeatable patterns in V3 that once understood, can be used to create and extend the system easily.

The following objects are a result of inspiration from principles such Single Responsibility Principle and Loose Coupling.

Message Object

The message object is responsible for all user supplied parameter validations, and turning them into a data object that can be used by subsequent object within the request cycle to perform desired actions.

Fetcher Object

The fetcher object’s responsibility is to get the record(s) from the database. It also handles filtering based on the query parameters supplied by the user.

Action Object

In requests where an action needs to be performed, such as a creation, deletion, or updating of a resource, an action object is used. Because Cloud Controller has a lot of hierarchies in its associations, having a separate action object focuses all of related operations to happen in a single object.

Presenter Object

The presenter object handles the final representation that results in the response for the user’s request. It implements a to_hash method that when supplied to the render method in ActionController, results in rendering JSON.

Clone this wiki locally