Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Full Architecture Guide

singleton (pres.) transient (pres.) transient (pres.) singleton (pres.)

Bind via Markup/HTML Directly couple from the component Directly couple from the component

Dumb (component) Polymorphic (component) Transient (component) Singleton (component)

You pass everything into You pass in the right from presenter This type of component will cover 90% of This type of component is for when
it, they are very flat and from a containing componment. This your requirements. It is coupled to a you want a component to share a
should have no deep way you can re-use this component transient presenter meaning that you presenter from another disconnected
architectural ‘polymorphically’. won’t get unpredictable side-effects component which needs to share
dependencies on the when it loads. This helps you ensure some two-way binding at the UI level
Black Box (apart from testing is clean because your tests can or persistent UI level state across
ViewModels). assume clean entry and exit. different component tree renders.

#1 Choosing The Right Component


Dumb Polymorphic Transient Singleton

#2 Component Type Examples


LastAddedBookComponent

AddBooksComponent
BooksComponent

BookListComponent

MessagesComponet

#3 Books Screen
AuthorListComponent
AuthorsComponent

AddAuthorComponent

AddBooksComponent

BookListComponent

MessagesComponet

#4 Authors Screen
https://rw7d2.csb.app/app/authors

AppComponent

BooksPresenter AuthorsPresenter
BooksComponent AuthorsComponent

static
dependency
LastAddedBook AuthorListComponent
runtime
dependency
AddAuthorComponent
dumb
AddBooksComponent
AddBooksComponent AddBooksComponent
polymorphic

BookListComponent BookListComponent
singleton

transient MessagesComponet MessagesComponent

#5 The Top-Level Architecture


passes presenter

passes vm BooksComponent

static
dependency LastAddedBook
BooksPresenter
runtime
dependency AddBooksComponent
BooksRepository

dumb
BookListComponent BookListPresenter

polymorphic

MessagesComponet MessagesPresenter
singleton

transient

#6 The Books Architecture


passes presenter

AuthorsComponent

static AuthorsPresenter
dependency AuthorListComponent AuthorsRepository
[pm driven toggle]

runtime
dependency AddAuthorsComponent

dumb
AddBooksComponent BookListPresenter BooksRepository

polymorphic

BookListComponent
singleton

transient MessagesComponet MessagesPresenter

#7 The Authors Architecture

You might also like