Skip to content

Architecture

M. Bellucci edited this page Oct 28, 2019 · 2 revisions

Backend Architecture

Inspired by this Robert.C Martin talk:

Architecture the Lost Years

Architecture the Lost Years by Robert Martin

Principles:

  • Architecture is not a bunch of tools
  • Architecture is about INTENT
  • The web is a delivery mechanism (I/O device)
  • Business-rules based architecture
  • Our architecture main concern is to keep business rules isolated from the rest
  • It clarifies functionality by making the business rule the center of our architecture
  • Use Case Driven Approach

Data Flow

  1. User submits a form
  2. Delivery mechanism takes data and creates a structure called RequestModel
  3. Interactor receives this request order model
  4. use data to pass to the entities ( orchestrates entities)
  5. gathers all the results data and creates a result model
  6. it passes the result-model to the output boundary which is implemented by Delivery Mechanism and somehow is delivered to the user.

Architecture for UI (Model View Presenter)

  1. Once interactor returns a response model a presenter receives it.
  • Presenter's job is to take a response model and translate it into a view model.
  • The view model should be so stupid that we don't have to test it.
  • Presenters are testable.

Architecture for database

  • Databases are I/O devices with interesting features
  • The database is a detail
  • Make DB a plugin to the business rules.
  • Interactors will talk to EntityGateway Interface
  • EntityGateway implements every possible access to the database
  • And returns (or call??) entities.
  • In the Interactor test you can stub your database.