SlideShare una empresa de Scribd logo
1 de 35
What is wrong with Dependency
Injection?
Igor Kochetov (@ k04a)
Unity Technologies
@k04a
The DI book
2
Authored by:
Mark “ploeh”
Seemann
Steven “.NET
Junkie” van
Deursen
Who am I?
Dev (C#, Python) in Opsy (Docker, k8s, GCP) world
Attendee: NDC (Oslo), New Crafts (Paris)
Speaker: BuildStuff (Vilnius), XP Days & .Net Fest (Kyiv)
Religious about engineering practices and team culture,
software design and good code
Toolsmith at Unity Technologies, based in Odessa
Twitter: @k04a
Linkedin: Igor Kochetov
@k04a
Why we even talk about DI in 2019?
There are conflicting opinions on the
subject of DI
Is it even still relevant?
4
@k04a
What is DI?
5
@k04a
Nice one, but there are still questions...
Who’s “we” who make sure you have
what you need?
How do we state “the need” in the code?
Why one would use it? What are the
benefits, actually?
6
Known benefits
Dependency Injection
❏ Reducing dependencies of
components (and implementation
details of those dependencies)
❏ Reusable code / swapping of
components
❏ More testable code
❏ More readable code (by defining
dependencies clearly)
Loose coupling
Isolated components are easier to:
❏ Modify, reuse or compose
differently
❏ Test
❏ Reason about
7
@k04a
It is about Dependencies...
Identifying dependencies in our
code (and types of dependencies)
Managing dependencies
8
@k04a
Programming to interfaces and D in SOLID
High-level modules should not depend
on low-level modules. Both should
depend on abstractions.
Abstractions should not depend on
details. Details should depend on
abstractions.
9
@k04a
Also related: who owns the abstractions?
Model abstractions around
domain-specific scenarios instead
of low-level implementation details
“Adapt” external dependencies to
match your domain concepts
Hexagonal architecture or
“Ports & Adapters”:
10
@k04a
Programming to interfaces and D in SOLID
ServiceX is still tightly
coupled to ServiceY!
11
How do we state “the need” in the code?
12
@k04a
Resolve dependencies using Service Locator
At first, looks like very good idea,
which makes it even more
dangerous.
But now we introduce new
dependency (on the container)
We also hide actual dependencies
How would you write tests for it?
13
@k04a
Constructor Injection is the way to go
❏ Explicitly lists
dependencies
❏ Gives clues about what
class might do
❏ Also an indicator of
possible SRP violations
14
@k04a
Wiring decoupled codebases
15
Who’s “we” who make sure you have
what you need?
Or “Mommy and Daddy providing a drink”
16
@k04a
Many platforms provide out-of-the box DI capabilities
.NET MVC / .NET Core MVC
Spring in Java
Angular JS
Kind of making it a de-facto standard
17
Myth: DI is a software library or a
framework
Or at least requires one to be done properly
@k04a 18
@k04a
IoC Container or DI Container
Container - software library that
‘resolves dependencies’ and manages
their ‘lifetime’
❏ Simplifies wiring and reduces
maintenance
❏ Simplifies testing
❏ Allows for dynamic configuration
❏ Supports AOP
But… Is it?
19
@k04a
Manually registering components in the container
20
@k04a
Composition Root and Pure DI
Creating all the stuff
‘normally’ in
Composition Root
(console app example)
21
@k04a
Is it OK to have all the components in the app root?
It is good idea to keep individual
components separated
Until we have to actually assemble
working application
22
@k04a
Explicit is better than implicit (Zen of Python)
Cost of writing vs cost of reading (or imagine
bringing a new member of the team into the
codebase)
Let IDE and code analysis tools be your
friends
It is actually IMPORTANT to know, what
your app does (well-structured Composition
Root serves as documentation providing
bird-eye view on high-level features and use-
cases)
23
@k04a
Composing within framework (.Net Core MVC)
As easy as registering a
custom IControllerActivator
24
@k04a
Composing within framework (.Net Core MVC)
… and implementing it
25
@k04a
Use-case for Aspect-Oriented-Programming
Applying cross-cutting concerns (also
known as non-functional requirements)
like:
❏ Logging
❏ Caching
❏ Security
26
@k04a
The power of Decorators (or AOP done right)
Wrap logging around any
actual implementation
using Decorator design
pattern
27
@k04a
Injecting decorated dependency
Wrap any number of
cross-cutting concerns
around actual
implementation
28
@k04a
Applying SOLID to extreme pushes you toward FP
A lot of single-method
interfaces and small focused
classes (implementations)
Which is good, until you have
to write Decorators for every of
them
29
@k04a
CQS and Parameter Object
Single generic
abstraction
Implementation
consists of two types:
❏ Command
❏ CommandHandler
30
@k04a
Decorator over generic ICommandHandler
Now every ‘aspect’
becomes single
Decorator over
generic
ICommandHandler
<TCommand>
interface
31
@k04a
Decorator over generic ICommandHandler
Write once, use
for all kinds of
Commands
32
@k04a
Conclusions & takeaways
Container is a dependency itself
It also might be a sign your codebase
grew too big (read “monolith”)
DI ≠ Container
DI is useful as a design pattern and
allows greater flexibility and more
manageable codebase (easier to test,
modify and reason about)
33
@k04a
The big idea (or what those have in common?)
❏ Dependency Injection (DI)
❏ Continuous Integration (CI) / Continuous Deployment (CD)
❏ Scrum, Lean or any Agile methodology / framework of your
choice
❏ DevOps
Answer: Those were meant to be PRACTICES (not Tools)
34
Q & A
35

Más contenido relacionado

La actualidad más candente

Applying EF Code First at Your Job
Applying EF Code First at Your JobApplying EF Code First at Your Job
Applying EF Code First at Your JobEnea Gabriel
 
Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!Massimo Bonanni
 
The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...
The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...
The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...Manuel Pais
 
Lesson 1 Understanding Dot Net Framework
Lesson 1   Understanding Dot Net FrameworkLesson 1   Understanding Dot Net Framework
Lesson 1 Understanding Dot Net Frameworknbaveja
 
Performance testing DataHelix | Scott Logic
Performance testing DataHelix | Scott LogicPerformance testing DataHelix | Scott Logic
Performance testing DataHelix | Scott LogicPaul Dykes
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Mohamed Saleh
 
Overview of .Net Framework
Overview of .Net FrameworkOverview of .Net Framework
Overview of .Net FrameworkNeha Singh
 
An isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasAn isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasVikash Chandra Das
 
.Net Framework Introduction
.Net Framework Introduction.Net Framework Introduction
.Net Framework IntroductionAbhishek Sahu
 
Introduction to .NET Programming
Introduction to .NET ProgrammingIntroduction to .NET Programming
Introduction to .NET ProgrammingKarthikeyan Mkr
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net frameworkThen Murugeshwari
 
Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...Microsoft Tech Community
 
dot net technology
dot net technologydot net technology
dot net technologyImran Khan
 
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...MongoDB
 
apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...
apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...
apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...apidays
 
Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with QuarkusNiklas Heidloff
 

La actualidad más candente (20)

Applying EF Code First at Your Job
Applying EF Code First at Your JobApplying EF Code First at Your Job
Applying EF Code First at Your Job
 
Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!Empower every Azure Function to achieve more!!
Empower every Azure Function to achieve more!!
 
The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...
The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...
The Elephant in the Kubernetes Room - Team Interactions at Scale @ KubeCon No...
 
Lesson 1 Understanding Dot Net Framework
Lesson 1   Understanding Dot Net FrameworkLesson 1   Understanding Dot Net Framework
Lesson 1 Understanding Dot Net Framework
 
Performance testing DataHelix | Scott Logic
Performance testing DataHelix | Scott LogicPerformance testing DataHelix | Scott Logic
Performance testing DataHelix | Scott Logic
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)
 
Overview of .Net Framework
Overview of .Net FrameworkOverview of .Net Framework
Overview of .Net Framework
 
An isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasAn isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra das
 
Programming in c#
Programming in c#Programming in c#
Programming in c#
 
Dependency injection
Dependency injectionDependency injection
Dependency injection
 
Electron
ElectronElectron
Electron
 
.Net Framework Introduction
.Net Framework Introduction.Net Framework Introduction
.Net Framework Introduction
 
Introduction to .NET Programming
Introduction to .NET ProgrammingIntroduction to .NET Programming
Introduction to .NET Programming
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...Best practices with Microsoft Graph: Making your applications more performant...
Best practices with Microsoft Graph: Making your applications more performant...
 
dot net technology
dot net technologydot net technology
dot net technology
 
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
 
Part i
Part iPart i
Part i
 
apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...
apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...
apidays LIVE Australia - Evaluating the usability of security APIs by Dr Nali...
 
Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with Quarkus
 

Similar a Igor Kochetov "What is wrong with Dependency Injection? Myths and Truths"

Cytoscape CI Chapter 2
Cytoscape CI Chapter 2Cytoscape CI Chapter 2
Cytoscape CI Chapter 2bdemchak
 
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | EdurekaTop 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | EdurekaEdureka!
 
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdfcNguyn506241
 
Docker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to DockerDocker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to DockerDocker, Inc.
 
Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday Walid Shaari
 
MOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEX
MOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEXMOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEX
MOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEXMonica Li
 
Oracle CNCF Meetup Malaga - Build CNCF projects in OCI
Oracle CNCF Meetup Malaga - Build CNCF projects in OCIOracle CNCF Meetup Malaga - Build CNCF projects in OCI
Oracle CNCF Meetup Malaga - Build CNCF projects in OCIOracle
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Trayan Iliev
 
SDN :: Software Defined Networking –2017 Executive Overview
SDN :: Software Defined Networking –2017 Executive OverviewSDN :: Software Defined Networking –2017 Executive Overview
SDN :: Software Defined Networking –2017 Executive OverviewChristian Esteve Rothenberg
 
Docker Birthday #5 Meetup Cluj - Presentation
Docker Birthday #5 Meetup Cluj - PresentationDocker Birthday #5 Meetup Cluj - Presentation
Docker Birthday #5 Meetup Cluj - PresentationAlex Vranceanu
 
Tampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerTampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerSakari Hoisko
 
"How to create an infrastructure in .NET", Leonid Chetverikov
"How to create an infrastructure in .NET", Leonid Chetverikov"How to create an infrastructure in .NET", Leonid Chetverikov
"How to create an infrastructure in .NET", Leonid ChetverikovFwdays
 
Java Programming
Java ProgrammingJava Programming
Java ProgrammingTracy Clark
 
Interoperable Clouds and How to Build (or Buy) Them
Interoperable Clouds and How to Build (or Buy) ThemInteroperable Clouds and How to Build (or Buy) Them
Interoperable Clouds and How to Build (or Buy) ThemMark Voelker
 
Meetup Devops-Geneva-19.10.2019
Meetup Devops-Geneva-19.10.2019Meetup Devops-Geneva-19.10.2019
Meetup Devops-Geneva-19.10.2019Hidora
 
Deploying deep learning models with Docker and Kubernetes
Deploying deep learning models with Docker and KubernetesDeploying deep learning models with Docker and Kubernetes
Deploying deep learning models with Docker and KubernetesPetteriTeikariPhD
 
Build Event-Driven Microservices with Confluent Cloud Workshop #1
Build Event-Driven Microservices with Confluent Cloud Workshop #1Build Event-Driven Microservices with Confluent Cloud Workshop #1
Build Event-Driven Microservices with Confluent Cloud Workshop #1confluent
 
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, SmileOCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, SmileOCCIware
 
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017Marc Dutoo
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsAmbassador Labs
 

Similar a Igor Kochetov "What is wrong with Dependency Injection? Myths and Truths" (20)

Cytoscape CI Chapter 2
Cytoscape CI Chapter 2Cytoscape CI Chapter 2
Cytoscape CI Chapter 2
 
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | EdurekaTop 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | Edureka
 
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
 
Docker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to DockerDocker Bday #5, SF Edition: Introduction to Docker
Docker Bday #5, SF Edition: Introduction to Docker
 
Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday Bahrain ch9 introduction to docker 5th birthday
Bahrain ch9 introduction to docker 5th birthday
 
MOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEX
MOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEXMOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEX
MOUG17: Oracle APEX - Tame IT Backlog Low Code Micro Apps in APEX
 
Oracle CNCF Meetup Malaga - Build CNCF projects in OCI
Oracle CNCF Meetup Malaga - Build CNCF projects in OCIOracle CNCF Meetup Malaga - Build CNCF projects in OCI
Oracle CNCF Meetup Malaga - Build CNCF projects in OCI
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux
 
SDN :: Software Defined Networking –2017 Executive Overview
SDN :: Software Defined Networking –2017 Executive OverviewSDN :: Software Defined Networking –2017 Executive Overview
SDN :: Software Defined Networking –2017 Executive Overview
 
Docker Birthday #5 Meetup Cluj - Presentation
Docker Birthday #5 Meetup Cluj - PresentationDocker Birthday #5 Meetup Cluj - Presentation
Docker Birthday #5 Meetup Cluj - Presentation
 
Tampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerTampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday Docker
 
"How to create an infrastructure in .NET", Leonid Chetverikov
"How to create an infrastructure in .NET", Leonid Chetverikov"How to create an infrastructure in .NET", Leonid Chetverikov
"How to create an infrastructure in .NET", Leonid Chetverikov
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Interoperable Clouds and How to Build (or Buy) Them
Interoperable Clouds and How to Build (or Buy) ThemInteroperable Clouds and How to Build (or Buy) Them
Interoperable Clouds and How to Build (or Buy) Them
 
Meetup Devops-Geneva-19.10.2019
Meetup Devops-Geneva-19.10.2019Meetup Devops-Geneva-19.10.2019
Meetup Devops-Geneva-19.10.2019
 
Deploying deep learning models with Docker and Kubernetes
Deploying deep learning models with Docker and KubernetesDeploying deep learning models with Docker and Kubernetes
Deploying deep learning models with Docker and Kubernetes
 
Build Event-Driven Microservices with Confluent Cloud Workshop #1
Build Event-Driven Microservices with Confluent Cloud Workshop #1Build Event-Driven Microservices with Confluent Cloud Workshop #1
Build Event-Driven Microservices with Confluent Cloud Workshop #1
 
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, SmileOCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
OCCIware presentation at EclipseDay in Lyon, November 2017, by Marc Dutoo, Smile
 
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
Model and pilot all cloud layers with OCCIware - Eclipse Day Lyon 2017
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
 

Más de Fwdays

"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...Fwdays
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil TopchiiFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro SpodaretsFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym KindritskyiFwdays
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...Fwdays
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...Fwdays
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...Fwdays
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...Fwdays
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...Fwdays
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...Fwdays
 
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast..."Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...Fwdays
 
"Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others..."Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others...Fwdays
 
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?", Oleksandra MyronovaFwdays
 
"Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv..."Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv...Fwdays
 
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin..."How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...Fwdays
 

Más de Fwdays (20)

"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
 
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast..."Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
 
"Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others..."Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others...
 
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
 
"Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv..."Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv...
 
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin..."How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
 

Último

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Último (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Igor Kochetov "What is wrong with Dependency Injection? Myths and Truths"

  • 1. What is wrong with Dependency Injection? Igor Kochetov (@ k04a) Unity Technologies
  • 2. @k04a The DI book 2 Authored by: Mark “ploeh” Seemann Steven “.NET Junkie” van Deursen
  • 3. Who am I? Dev (C#, Python) in Opsy (Docker, k8s, GCP) world Attendee: NDC (Oslo), New Crafts (Paris) Speaker: BuildStuff (Vilnius), XP Days & .Net Fest (Kyiv) Religious about engineering practices and team culture, software design and good code Toolsmith at Unity Technologies, based in Odessa Twitter: @k04a Linkedin: Igor Kochetov
  • 4. @k04a Why we even talk about DI in 2019? There are conflicting opinions on the subject of DI Is it even still relevant? 4
  • 6. @k04a Nice one, but there are still questions... Who’s “we” who make sure you have what you need? How do we state “the need” in the code? Why one would use it? What are the benefits, actually? 6
  • 7. Known benefits Dependency Injection ❏ Reducing dependencies of components (and implementation details of those dependencies) ❏ Reusable code / swapping of components ❏ More testable code ❏ More readable code (by defining dependencies clearly) Loose coupling Isolated components are easier to: ❏ Modify, reuse or compose differently ❏ Test ❏ Reason about 7
  • 8. @k04a It is about Dependencies... Identifying dependencies in our code (and types of dependencies) Managing dependencies 8
  • 9. @k04a Programming to interfaces and D in SOLID High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions. 9
  • 10. @k04a Also related: who owns the abstractions? Model abstractions around domain-specific scenarios instead of low-level implementation details “Adapt” external dependencies to match your domain concepts Hexagonal architecture or “Ports & Adapters”: 10
  • 11. @k04a Programming to interfaces and D in SOLID ServiceX is still tightly coupled to ServiceY! 11
  • 12. How do we state “the need” in the code? 12
  • 13. @k04a Resolve dependencies using Service Locator At first, looks like very good idea, which makes it even more dangerous. But now we introduce new dependency (on the container) We also hide actual dependencies How would you write tests for it? 13
  • 14. @k04a Constructor Injection is the way to go ❏ Explicitly lists dependencies ❏ Gives clues about what class might do ❏ Also an indicator of possible SRP violations 14
  • 16. Who’s “we” who make sure you have what you need? Or “Mommy and Daddy providing a drink” 16
  • 17. @k04a Many platforms provide out-of-the box DI capabilities .NET MVC / .NET Core MVC Spring in Java Angular JS Kind of making it a de-facto standard 17
  • 18. Myth: DI is a software library or a framework Or at least requires one to be done properly @k04a 18
  • 19. @k04a IoC Container or DI Container Container - software library that ‘resolves dependencies’ and manages their ‘lifetime’ ❏ Simplifies wiring and reduces maintenance ❏ Simplifies testing ❏ Allows for dynamic configuration ❏ Supports AOP But… Is it? 19
  • 21. @k04a Composition Root and Pure DI Creating all the stuff ‘normally’ in Composition Root (console app example) 21
  • 22. @k04a Is it OK to have all the components in the app root? It is good idea to keep individual components separated Until we have to actually assemble working application 22
  • 23. @k04a Explicit is better than implicit (Zen of Python) Cost of writing vs cost of reading (or imagine bringing a new member of the team into the codebase) Let IDE and code analysis tools be your friends It is actually IMPORTANT to know, what your app does (well-structured Composition Root serves as documentation providing bird-eye view on high-level features and use- cases) 23
  • 24. @k04a Composing within framework (.Net Core MVC) As easy as registering a custom IControllerActivator 24
  • 25. @k04a Composing within framework (.Net Core MVC) … and implementing it 25
  • 26. @k04a Use-case for Aspect-Oriented-Programming Applying cross-cutting concerns (also known as non-functional requirements) like: ❏ Logging ❏ Caching ❏ Security 26
  • 27. @k04a The power of Decorators (or AOP done right) Wrap logging around any actual implementation using Decorator design pattern 27
  • 28. @k04a Injecting decorated dependency Wrap any number of cross-cutting concerns around actual implementation 28
  • 29. @k04a Applying SOLID to extreme pushes you toward FP A lot of single-method interfaces and small focused classes (implementations) Which is good, until you have to write Decorators for every of them 29
  • 30. @k04a CQS and Parameter Object Single generic abstraction Implementation consists of two types: ❏ Command ❏ CommandHandler 30
  • 31. @k04a Decorator over generic ICommandHandler Now every ‘aspect’ becomes single Decorator over generic ICommandHandler <TCommand> interface 31
  • 32. @k04a Decorator over generic ICommandHandler Write once, use for all kinds of Commands 32
  • 33. @k04a Conclusions & takeaways Container is a dependency itself It also might be a sign your codebase grew too big (read “monolith”) DI ≠ Container DI is useful as a design pattern and allows greater flexibility and more manageable codebase (easier to test, modify and reason about) 33
  • 34. @k04a The big idea (or what those have in common?) ❏ Dependency Injection (DI) ❏ Continuous Integration (CI) / Continuous Deployment (CD) ❏ Scrum, Lean or any Agile methodology / framework of your choice ❏ DevOps Answer: Those were meant to be PRACTICES (not Tools) 34