(B)VIPER
MODULES
BREAK THE MONOLITH WITH
Nicola Zaghini - nzaghini@gmail.com - @nzaghini
UNCLE BOB HTTPS://8THLIGHT.COM
MUTUAL MOBILE ENGINEERING
FANCY A SLICE 🍰😬 ?
We strive to make travel better and to
enable our customers to shape new and
superior travel experiences 

with innovative, personalised mobile and
digital offerings.
The road to 

(B)VIPER
DEFINING 

THE MODULE
Flight

Search
Flight

Availability
Flight

Summary
WHAT IS AN APPLICATION ?
Flight

Search
Flight

Availability
Flight

Summary
WHAT IS A MODULE ?
HOW DO WE WANT MODULES?
Composable

Application = SUM ( Modules )

Module = SUM ( Components )
Black box

Expose clear APIs.

The outside world should not know internal details.
Testable

“Isolation checks” made simple!
Independent of User Interface 

User interface must change without impacting the rest of the system.
Independent of Frameworks

Database, UI framework, Network, …
Simple

Small and well defined parts delivering one function.
MODULES
APPLICATION = SUM (MODULES )
Availability Service

Booking Service

Payment Service

Check-in Service

…
Mobile
Application
Remote
Services
DESIGN THE MODULE
C4 MODELS
A WAY OF COMMUNICATING SOFTWARE SYSTEMS
Mobile Application
Flight
Search
DESIGN THE MODULE
Availability Service

Booking Service

Payment Service

Check-in Service

…
Flight
Availability
Flight
Summary
Services
&
Entities
Services
&
Entities
Flight

Availability
Flight
Search
Flight
Summary
Flight

Availability
UIView
Controller
Flight
Search
Flight
Summary
Services
&
Entities
1K+ lines 

UIViewController 😱?
I think we can do better
😎
View
Model
View
User Interface

No B. Logic
Data Model Converter for the View
Apply Application BL
Routing
Flight
Search
Flight
Summary
MVVM APPROACH
Services
&
Entities
Domain Model to View Model mapping
User interaction
Apply Business Rules
Routing
Overall, there are too many reason to change the
ViewModel - Single responsibility principle violated
VIEW MODEL RESPONSIBILITIES
View
Model
Flight

Availability
View
User Interface

No B. Logic
Flight
Search
Flight
Summary
Data Model Converter for the View
Listen to View events
Apply Application BL
Routing
Services
&
Entities
View
Model
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
Flight
Search
Flight
Summary
Data Model Converter for the View
Listen to View events
Apply Application BL
Services
&
Entities
protocol WeatherListRouter {
func navigateToDetail(location: Location)
func navigateToAddWeatherLocation()
}
ROUTER CONTRACT
View
Model
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
Flight
Search
Flight
Summary
Data Model Converter for the View
Listen to View events
Apply Application BL
Services
&
Entities
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listen to View
events
Apply App BL
Data Model
Converter 

for the View
Flight
Search
Flight
Summary
Services
&
Entities
protocol WeatherListPresenter {
func loadContent()
func presentWeatherDetail(location: String)
func presentAddWeatherLocation()
}
PRESENTER CONTRACT
protocol WeatherListView {
func displayLocationList(vm: LocationListVM)
func displayError(errorMessage: String)
}
VIEW CONTRACT
struct LocationListViewModel {
let locations: [LocationViewModel]
}
struct LocationViewModel {
let locationId: String
let name: String
let detail: String
}
VIEW MODEL
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Data Model
Converter 

for the View
Flight
Search
Flight
Summary
Listen to View
events
Apply App BR
Services
&
Entities
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Apply Application

Business Rules
Flight
Search
Flight
Summary
Services
&
Entities
public protocol WeatherListInteractor {
func locations() -> [Location]
}
INTERACTOR CONTRACT
PresenterView
Next Module
Navigation
Router
View
Model
Interactor
- loadContent

- presentWeatherDetail
Flight
Search
- locations
LocationListViewModel
- displayLocations
- navigateToWeatherDetail
COMPONENTS INTERACTION
Cool, are we there yet?
…nope 🚀
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Flight
Search
Flight
Summary?🤔?
Apply Application

Business Rules
Services
&
Entities
Presenter😐
User Interface

No B. Logic
Next Module
Navigation
😐
😐
Listens to View
events
Data Model
Converter 

for the View
😐
Flight
Search
Flight
Summary?🤔?
Apply Application

Business Rules
TESTING IS SIMPLE
Services
&
Entities
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Flight
Search
Flight
Summary?🤔?
Apply Application

Business Rules
Services
&
Entities
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Flight
Search
Flight
Summary
Builder
😀
Creates and
wires
components
Apply Application

Business Rules
Services
&
Entities
Knows how to wire the Module components.

Knows concrete Components implementation.

Dependency Injection.

Module exposed as Black Box 

ViewController to the outside world.
Input

Parameters
View

Controller
THE BUILDER COMPONENT
Builder
public protocol WeatherListBuilder {
func buildModule() -> UIViewController?
}
BUILDER CONTRACT
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Flight
Search
Flight
Summary
Builder
Creates and
wires
components
Apply Application

Business Rules
Services
&
Entities
Presenter
Flight

Availability
My
View
User Interface

No B. Logic
Next Module
Navigation
My
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Flight
Search
Flight
Summary
Builder
Creates and
wires
components
Apply Application

Business Rules
Services
&
Entities
Presenter
Flight

Availability
View
User Interface

No B. Logic
Next Module
Navigation
Router
View
Model
Listens to View
events
Data Model
Converter 

for the View
Interactor
Apply Application

Business Rules
Services
&
Entities
FANCY A SLICE 🍰😬 ?
Entities and Services
Interactor
Presenter
View Model
View
Router
MODULE
(B)uilder
Current status.
Composable ✅

Application = SUM ( Modules )

Module = SUM ( Components )
Black box ✅

The outside world should not know internal details.

Exposes clear APIs.
Testable ✅

Promoting easy isolation checks of the parts and the whole.
Independent of User Interface ✅

User interface must change easily without impacting the rest of the system.
Independent of Frameworks ✅

Database, UI framework, Network, …
Simple ✅

Small and well defined parts delivering one function.
Sending information between (B)VIPER Modules
… what if To Module is modal?

To_Module accepts a delegate which is a component of the
From_Module (usually the Presenter)
Router
From Module To Module
Router provides 

out data needed
by the next
Builder
Builder
TIP #1
Window
Router
InteractorView
(VC)
Presenter
References among components
Strong
Weak
Strong
Weak
W
eak
Strong
Strong
When the ViewController is deallocated, the whole module gets
deallocated.
TIP #2
Crossing boundaries Models
TIP #3
Dependency Management Tool

supporting Semantic Versioning!
(CocoaPod, Carthage)
Dependency Injection Container
(Typhoon, Swinject)
TIP #4
INTEGRATED TEST ARE A SCAM
by J.B. Rainsberger
SIMPLE MADE EASY
by Rich Hickey
WATCH LIST SUGGESTIONS 👀
CLEAN ARCHITECTURE AND DESIGN

by Robert C. Martin
No such thing as

one-size fits all.
@nzaghini

nzaghini@gmail.com
(B)VIPER example repo: 

http://bit.ly/B_VIPER
I use unsplash.com to make slides look great!

More Related Content

PDF
Infinum iOS Talks #4 - Making our VIPER more reactive
PDF
From mvc to viper
PDF
iOS viper presentation
PPTX
Sexy Architecting. VIPER: MVP on steroids
PDF
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
PDF
Rambler.iOS #5: Разбираем Massive View Controller
PDF
Web sockets in Angular
PDF
Introduction to Spring MVC
Infinum iOS Talks #4 - Making our VIPER more reactive
From mvc to viper
iOS viper presentation
Sexy Architecting. VIPER: MVP on steroids
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Rambler.iOS #5: Разбираем Massive View Controller
Web sockets in Angular
Introduction to Spring MVC

What's hot (20)

PDF
Angular2 Development for Java developers
PPTX
Angular 4
PPTX
Introduction to Angular JS
PPTX
Async patterns in javascript
PPTX
Front end development with Angular JS
PPTX
angularJs Workshop
PPTX
Angular js presentation at Datacom
PPTX
Angular js 1.3 presentation for fed nov 2014
PPT
Backbone js
ODP
Spray - Build RESTfull services in scala
PPTX
Introduction to Angularjs
PPTX
Angular js 1.0-fundamentals
PPTX
AngularJs Workshop SDP December 28th 2014
PDF
Angular 2.0 - What to expect
PPTX
AngularJS 2.0
PPT
Spring MVC Basics
ODP
OpenWebBeans/Web Beans
PDF
SpringMVC
PPTX
Angular js
PPTX
AngularJs presentation
Angular2 Development for Java developers
Angular 4
Introduction to Angular JS
Async patterns in javascript
Front end development with Angular JS
angularJs Workshop
Angular js presentation at Datacom
Angular js 1.3 presentation for fed nov 2014
Backbone js
Spray - Build RESTfull services in scala
Introduction to Angularjs
Angular js 1.0-fundamentals
AngularJs Workshop SDP December 28th 2014
Angular 2.0 - What to expect
AngularJS 2.0
Spring MVC Basics
OpenWebBeans/Web Beans
SpringMVC
Angular js
AngularJs presentation
Ad

Viewers also liked (7)

PPTX
iOS Architecture
PDF
Rambler.iOS #5: Переходы и передача данных между VIPER модулями
PPTX
VIPER - Design Pattern
PDF
PDF
Rambler.iOS #5: VIPER и Swift
PDF
Continuous Delivery for databases - microservices, team structures, and Conwa...
DOCX
Jose Marti - Versos sencillos (antologia para niños)
iOS Architecture
Rambler.iOS #5: Переходы и передача данных между VIPER модулями
VIPER - Design Pattern
Rambler.iOS #5: VIPER и Swift
Continuous Delivery for databases - microservices, team structures, and Conwa...
Jose Marti - Versos sencillos (antologia para niños)
Ad

Similar to Break the monolith with (B)VIPER Modules (20)

PPT
Architectural solutions for the cloud
PPTX
Angular from Zero to Mastery - Training (Intermediate)
PDF
Domain specific modeling for mobile and io t apps
PPT
Angular Introduction By Surekha Gadkari
PDF
Building Event Driven (Micro)services with Apache Kafka
PPTX
SAP Inside Track 2010 - Thomas Jung Intro to WDA
PPT
MAX 2008: Build collaborative applications with Flex LCDS and Cairngorm
PDF
All About Microservices and OpenSource Microservice Frameworks
PPTX
Intland Software | codeBeamer ALM: What’s in the Pipeline for the Automotive ...
PDF
Mobile architectures
PPTX
Implementing clean architecture in Hitro taxi project (Hamed safari)
PDF
OpenShift Taiwan Vol.1 Technology Overview
PPTX
MongoDB.local Atlanta: Introduction to Serverless MongoDB
PDF
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
PPTX
MobiCloud: Towards Cloud Mobile Hybrid Application Generation using Semantica...
PPT
Silverlight 2 for Developers - TechEd New Zealand 2008
ODP
VIPER
PPTX
Fy10 Software + Services Cloud Overview 2 of 4
PDF
Oracle ADF Tutorial
PDF
Creating 3 Beautiful Apps At Once - Intro To Xamarin.Forms
Architectural solutions for the cloud
Angular from Zero to Mastery - Training (Intermediate)
Domain specific modeling for mobile and io t apps
Angular Introduction By Surekha Gadkari
Building Event Driven (Micro)services with Apache Kafka
SAP Inside Track 2010 - Thomas Jung Intro to WDA
MAX 2008: Build collaborative applications with Flex LCDS and Cairngorm
All About Microservices and OpenSource Microservice Frameworks
Intland Software | codeBeamer ALM: What’s in the Pipeline for the Automotive ...
Mobile architectures
Implementing clean architecture in Hitro taxi project (Hamed safari)
OpenShift Taiwan Vol.1 Technology Overview
MongoDB.local Atlanta: Introduction to Serverless MongoDB
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
MobiCloud: Towards Cloud Mobile Hybrid Application Generation using Semantica...
Silverlight 2 for Developers - TechEd New Zealand 2008
VIPER
Fy10 Software + Services Cloud Overview 2 of 4
Oracle ADF Tutorial
Creating 3 Beautiful Apps At Once - Intro To Xamarin.Forms

Recently uploaded (20)

PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Website Design Services for Small Businesses.pdf
PPTX
Introduction to Windows Operating System
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Advanced SystemCare Ultimate Crack + Portable (2025)
Oracle Fusion HCM Cloud Demo for Beginners
Monitoring Stack: Grafana, Loki & Promtail
CNN LeNet5 Architecture: Neural Networks
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Patient Appointment Booking in Odoo with online payment
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
Wondershare Recoverit Full Crack New Version (Latest 2025)
CCleaner 6.39.11548 Crack 2025 License Key
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Topaz Photo AI Crack New Download (Latest 2025)
MCP Security Tutorial - Beginner to Advanced
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Computer Software and OS of computer science of grade 11.pptx
Weekly report ppt - harsh dattuprasad patel.pptx
Website Design Services for Small Businesses.pdf
Introduction to Windows Operating System

Break the monolith with (B)VIPER Modules