SlideShare uma empresa Scribd logo
1 de 49
Manage software dependencies with IoC and AOP Stefano Leli 14° Workshop DotNetMarche Friday 16 th  April 2010 @sleli [email_address]
[object Object],[object Object],[object Object],[object Object],[object Object],Agenda
[object Object]
Dependencies public RequestService() { ClassB b = new ClassB() b.DoService(); } dependent +DoService() ClassA +RequestService() ClassB
Layer Dependencies ,[object Object],[object Object],Presentation Layer Business Layer Data Access Layer Depends  on DB Depends  on Depends  on
Why dependencies are evil? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
Copier Example Copier + PerformCopy() Keyboard + ReadFromKB(c : char ) Video + WriteToVideo ()  : char
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Copier Example class Keyboard { public int ReadFromKeyboard() {  return Console.ReadKey(true).KeyChar; } } class Video { public void WriteToVideo(int chr) { Console.Write((char)chr); } }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Copier Example class Keyboard { public int ReadFromKeyboard() {  return Console.ReadKey(true).KeyChar; } } class Video { public void WriteToVideo(int chr) { Console.Write((char)chr); } } Problem
[object Object]
Copier Example <<create>> <<create>> Concrete class should depend on abstraction Robert Martin IWriter IReader Copier + PerformCopy() Keyboard + Read(c : char ) Video + Write ()  : char
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Copier Example class Keyboard  : IReader { public int  Read () {  return Console.ReadKey(true).KeyChar; } } class Video  : IWriter { public void  Write (int chr) { Console.Write((char)chr); } }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Copier Example class Keyboard  : IReader { public int  Read () {  return Console.ReadKey(true).KeyChar; } } class Video  : IWriter { public void  Write (int chr) { Console.Write((char)chr); } } Problem Dependencies resolution is still here!!!
[object Object],[object Object]
<<create>> Using a Factory <<create>> Copier + Copier(r : IReader, w : IWriter) + PerformCopy() IWriter IReader Keyboard + Read(c : char ) Video + Write ()  : char ReaderFactory + GetInstance() : IReader WriterFactory + GetInstance() : IWriter
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Using a Factory class ReaderFactory { public static IReader GetInstance() { return new Keyboard(); } } class WriterFactory { public static IWriter GetInstance() { return new Video(); } }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Using a Factory class ReaderFactory { public static IReader GetInstance() { return new Keyboard(); } } class WriterFactory { public static IWriter GetInstance() { return new Video(); } } We have just moved the problem!!! Problem
Service Locator << create >> <<create>> Copier + PerformCopy() ServiceLocator +Lookup() : Object +RegisterService(o : Object) _instance : ServiceLocator … IWriter IReader Keyboard + Read(c : char ) Video + Write ()  : char
Service Locator << create >> <<create>> Copier + PerformCopy() ServiceLocator +Lookup() : Object +RegisterService(o : Object) _instance : ServiceLocator … IWriter IReader Keyboard + Read(c : char ) Video + Write ()  : char
Service Locator class ServiceLocator { /* Singleton instance */ private static ServiceLocator _instance;  public static void Load(ServiceLocator arg) { _instance = arg; } /* Storing and Retrieve services */ private Dictionary<string, Object> _services = new Dictionary<string, Object>(); public Object RegisterService(String key) { return _instance._services[key]; } public static void Lookup(String key, Object service) { _services.Add(key, service); } }
Service Locator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],/*  Configure Service Locator method */ private void configureLocator() { ServiceLocator locator = new ServiceLocator();  locator.LoadService(&quot;reader&quot;, new Keyboard()); locator.LoadService(&quot;writer&quot;, new Video()); ServiceLocator.Load(locator); }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Service Locator
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],What is IoC?
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],What is Dependency Injection?
IoC Container Copier + Copier(r : IReader, w : IWriter) + PerformCopy() IWriter IReader Keyboard + Read(c : char ) Video + Write ()  : char
<< create >> <<create>> IoC Container <<create>> Copier + Copier(r : IReader, w : IWriter) + PerformCopy() XML Config IWriter IReader Keyboard + Read(c : char ) Video + Write ()  : char IoCContainer …
DI: Constructor Injection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],To prefer in case of Mandatory Dependencies
DI: Setter Injection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],To prefer in case of Optional Dependencies
DI: Interface Injection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface IReaderInject { void injectReader(IReader reader);  } interface IWriterInject { void injectWriter(IWriter reader);  } Quite Never Used
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],DI: Consideration
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],What is AOP?
Separation of Concern Searching Booking Payment
Separation of Concern ,[object Object],[object Object],[object Object],[object Object],Booking Payment Searching OOP Searching Booking Payment
Crosscutting Concern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Booking Security Logging Payment Security Logging Searching Security Logging OOP Crosscutting  Concerns Searching Booking Payment
Crosscutting Concern Booking Payment Searching Security Logging AOP Booking Security Logging Payment Security Logging Searching Security Logging OOP Crosscutting Concerns Searching Booking Payment
How it works… Object_B Object_A Object Oriented Flow
How it works… Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
How it works… ,[object Object],[object Object],[object Object],Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
How it works… ,[object Object],[object Object],Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
How it works… ,[object Object],[object Object],Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
How it works… ,[object Object],[object Object],[object Object],Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
How it works… ,[object Object],[object Object],[object Object],Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
[object Object],[object Object],[object Object],…  behind the scenes Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation Weaving
References ,[object Object],[object Object],[object Object],[object Object],[object Object]
Questions?
Slide and Materials ,[object Object],Grazie!

Mais conteúdo relacionado

Mais procurados

JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
Writing usableap isinpractice
Writing usableap isinpracticeWriting usableap isinpractice
Writing usableap isinpracticeGiovanni Asproni
 
C# 6.0 - DotNetNotts
C# 6.0 - DotNetNottsC# 6.0 - DotNetNotts
C# 6.0 - DotNetNottscitizenmatt
 
IronSmalltalk
IronSmalltalkIronSmalltalk
IronSmalltalkESUG
 
Demonstration Of The Open Mi
Demonstration Of The Open MiDemonstration Of The Open Mi
Demonstration Of The Open MiJan Gregersen
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Antoine Sabot-Durand
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Languageintelliyole
 
Why Spring <3 Kotlin
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 KotlinVMware Tanzu
 
From code to pattern, part one
From code to pattern, part oneFrom code to pattern, part one
From code to pattern, part oneBingfeng Zhao
 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMashleypuls
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy CodeRowan Merewood
 
ADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersBartosz Kosarzycki
 

Mais procurados (20)

JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
64-bit Loki
64-bit Loki64-bit Loki
64-bit Loki
 
Writing usableap isinpractice
Writing usableap isinpracticeWriting usableap isinpractice
Writing usableap isinpractice
 
C# 6.0 - DotNetNotts
C# 6.0 - DotNetNottsC# 6.0 - DotNetNotts
C# 6.0 - DotNetNotts
 
Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014
 
IronSmalltalk
IronSmalltalkIronSmalltalk
IronSmalltalk
 
Demonstration Of The Open Mi
Demonstration Of The Open MiDemonstration Of The Open Mi
Demonstration Of The Open Mi
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014Introduction to cdi given at java one 2014
Introduction to cdi given at java one 2014
 
An Overview of Project Jigsaw
An Overview of Project JigsawAn Overview of Project Jigsaw
An Overview of Project Jigsaw
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
 
Google Dart
Google DartGoogle Dart
Google Dart
 
Parm
ParmParm
Parm
 
Why Spring <3 Kotlin
Why Spring <3 KotlinWhy Spring <3 Kotlin
Why Spring <3 Kotlin
 
From code to pattern, part one
From code to pattern, part oneFrom code to pattern, part one
From code to pattern, part one
 
Bytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASMBytecode manipulation with Javassist and ASM
Bytecode manipulation with Javassist and ASM
 
Project Coin
Project CoinProject Coin
Project Coin
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
ADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developers
 

Semelhante a Manage software dependencies with ioc and aop

Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software DevelopmentZeeshan MIrza
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Eclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classesEclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classesLuca D'Onofrio
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Maarten Balliauw
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Jimmy Schementi
 
TWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonTWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonCodemotion
 
Development workflow
Development workflowDevelopment workflow
Development workflowSigsiu.NET
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Itzik Kotler
 
Better Code: Concurrency
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: ConcurrencyPlatonov Sergey
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...Sang Don Kim
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
Lec15a1-Object-Oriented Development.ppt
Lec15a1-Object-Oriented Development.pptLec15a1-Object-Oriented Development.ppt
Lec15a1-Object-Oriented Development.pptemanamin19
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsAzul Systems, Inc.
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Maarten Balliauw
 
iOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomeriOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomerAndri Yadi
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1Abdul Haseeb
 

Semelhante a Manage software dependencies with ioc and aop (20)

Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Eclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classesEclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classes
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011
 
TWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonTWINS: OOP and FP - Warburton
TWINS: OOP and FP - Warburton
 
Development workflow
Development workflowDevelopment workflow
Development workflow
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
 
Better Code: Concurrency
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: Concurrency
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
LLVM
LLVMLLVM
LLVM
 
Lec15a1-Object-Oriented Development.ppt
Lec15a1-Object-Oriented Development.pptLec15a1-Object-Oriented Development.ppt
Lec15a1-Object-Oriented Development.ppt
 
Iron python
Iron pythonIron python
Iron python
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
 
iOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomeriOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for Jasakomer
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Mufix Network Programming Lecture
Mufix Network Programming LectureMufix Network Programming Lecture
Mufix Network Programming Lecture
 

Mais de Stefano Leli

Agile quackery a brief history of the worst ways to cure everything
Agile quackery   a brief history of the worst ways to cure everythingAgile quackery   a brief history of the worst ways to cure everything
Agile quackery a brief history of the worst ways to cure everythingStefano Leli
 
Agile goes Hollywood - Un approccio empirico alle trasformazioni agili
Agile goes Hollywood - Un approccio empirico alle trasformazioni agiliAgile goes Hollywood - Un approccio empirico alle trasformazioni agili
Agile goes Hollywood - Un approccio empirico alle trasformazioni agiliStefano Leli
 
Succeding with feature teams
Succeding with feature teamsSucceding with feature teams
Succeding with feature teamsStefano Leli
 
User Story Mapping
User Story MappingUser Story Mapping
User Story MappingStefano Leli
 
La tua prima kanban board
La tua prima kanban boardLa tua prima kanban board
La tua prima kanban boardStefano Leli
 
Dinosaur Carpaccio - How to implement valuable micro-requirements
Dinosaur Carpaccio - How to implement valuable micro-requirementsDinosaur Carpaccio - How to implement valuable micro-requirements
Dinosaur Carpaccio - How to implement valuable micro-requirementsStefano Leli
 
From Vision To Product
From Vision To ProductFrom Vision To Product
From Vision To ProductStefano Leli
 
Agile retrospective,an example
Agile retrospective,an exampleAgile retrospective,an example
Agile retrospective,an exampleStefano Leli
 
User stories writing - Codemotion 2013
User stories writing   - Codemotion 2013User stories writing   - Codemotion 2013
User stories writing - Codemotion 2013Stefano Leli
 
User Stories Writing
User Stories WritingUser Stories Writing
User Stories WritingStefano Leli
 
Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11Stefano Leli
 
Il project manager e lo sviluppo agile. Separati in casa?
Il project manager e lo sviluppo agile. Separati in casa?Il project manager e lo sviluppo agile. Separati in casa?
Il project manager e lo sviluppo agile. Separati in casa?Stefano Leli
 
Codice legacy, usciamo dal pantano!
Codice legacy, usciamo dal pantano!Codice legacy, usciamo dal pantano!
Codice legacy, usciamo dal pantano!Stefano Leli
 
Design Pattern In Pratica
Design Pattern In PraticaDesign Pattern In Pratica
Design Pattern In PraticaStefano Leli
 
Workshop Su Refactoring
Workshop Su RefactoringWorkshop Su Refactoring
Workshop Su RefactoringStefano Leli
 
Intoduzione Alle Metodologie Agili
Intoduzione Alle Metodologie AgiliIntoduzione Alle Metodologie Agili
Intoduzione Alle Metodologie AgiliStefano Leli
 

Mais de Stefano Leli (17)

Agile quackery a brief history of the worst ways to cure everything
Agile quackery   a brief history of the worst ways to cure everythingAgile quackery   a brief history of the worst ways to cure everything
Agile quackery a brief history of the worst ways to cure everything
 
Agile goes Hollywood - Un approccio empirico alle trasformazioni agili
Agile goes Hollywood - Un approccio empirico alle trasformazioni agiliAgile goes Hollywood - Un approccio empirico alle trasformazioni agili
Agile goes Hollywood - Un approccio empirico alle trasformazioni agili
 
Succeding with feature teams
Succeding with feature teamsSucceding with feature teams
Succeding with feature teams
 
User Story Mapping
User Story MappingUser Story Mapping
User Story Mapping
 
La tua prima kanban board
La tua prima kanban boardLa tua prima kanban board
La tua prima kanban board
 
Dinosaur Carpaccio - How to implement valuable micro-requirements
Dinosaur Carpaccio - How to implement valuable micro-requirementsDinosaur Carpaccio - How to implement valuable micro-requirements
Dinosaur Carpaccio - How to implement valuable micro-requirements
 
From Vision To Product
From Vision To ProductFrom Vision To Product
From Vision To Product
 
Agile retrospective,an example
Agile retrospective,an exampleAgile retrospective,an example
Agile retrospective,an example
 
User stories writing - Codemotion 2013
User stories writing   - Codemotion 2013User stories writing   - Codemotion 2013
User stories writing - Codemotion 2013
 
User Stories Writing
User Stories WritingUser Stories Writing
User Stories Writing
 
Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11Codice legacy, usciamo dal pantano! @iad11
Codice legacy, usciamo dal pantano! @iad11
 
XP Game
XP GameXP Game
XP Game
 
Il project manager e lo sviluppo agile. Separati in casa?
Il project manager e lo sviluppo agile. Separati in casa?Il project manager e lo sviluppo agile. Separati in casa?
Il project manager e lo sviluppo agile. Separati in casa?
 
Codice legacy, usciamo dal pantano!
Codice legacy, usciamo dal pantano!Codice legacy, usciamo dal pantano!
Codice legacy, usciamo dal pantano!
 
Design Pattern In Pratica
Design Pattern In PraticaDesign Pattern In Pratica
Design Pattern In Pratica
 
Workshop Su Refactoring
Workshop Su RefactoringWorkshop Su Refactoring
Workshop Su Refactoring
 
Intoduzione Alle Metodologie Agili
Intoduzione Alle Metodologie AgiliIntoduzione Alle Metodologie Agili
Intoduzione Alle Metodologie Agili
 

Último

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
[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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
[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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
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
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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...
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Manage software dependencies with ioc and aop

  • 1. Manage software dependencies with IoC and AOP Stefano Leli 14° Workshop DotNetMarche Friday 16 th April 2010 @sleli [email_address]
  • 2.
  • 3.
  • 4. Dependencies public RequestService() { ClassB b = new ClassB() b.DoService(); } dependent +DoService() ClassA +RequestService() ClassB
  • 5.
  • 6.
  • 7.
  • 8. Copier Example Copier + PerformCopy() Keyboard + ReadFromKB(c : char ) Video + WriteToVideo () : char
  • 9.
  • 10.
  • 11.
  • 12. Copier Example <<create>> <<create>> Concrete class should depend on abstraction Robert Martin IWriter IReader Copier + PerformCopy() Keyboard + Read(c : char ) Video + Write () : char
  • 13.
  • 14.
  • 15.
  • 16. <<create>> Using a Factory <<create>> Copier + Copier(r : IReader, w : IWriter) + PerformCopy() IWriter IReader Keyboard + Read(c : char ) Video + Write () : char ReaderFactory + GetInstance() : IReader WriterFactory + GetInstance() : IWriter
  • 17.
  • 18.
  • 19. Service Locator << create >> <<create>> Copier + PerformCopy() ServiceLocator +Lookup() : Object +RegisterService(o : Object) _instance : ServiceLocator … IWriter IReader Keyboard + Read(c : char ) Video + Write () : char
  • 20. Service Locator << create >> <<create>> Copier + PerformCopy() ServiceLocator +Lookup() : Object +RegisterService(o : Object) _instance : ServiceLocator … IWriter IReader Keyboard + Read(c : char ) Video + Write () : char
  • 21. Service Locator class ServiceLocator { /* Singleton instance */ private static ServiceLocator _instance; public static void Load(ServiceLocator arg) { _instance = arg; } /* Storing and Retrieve services */ private Dictionary<string, Object> _services = new Dictionary<string, Object>(); public Object RegisterService(String key) { return _instance._services[key]; } public static void Lookup(String key, Object service) { _services.Add(key, service); } }
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. IoC Container Copier + Copier(r : IReader, w : IWriter) + PerformCopy() IWriter IReader Keyboard + Read(c : char ) Video + Write () : char
  • 28. << create >> <<create>> IoC Container <<create>> Copier + Copier(r : IReader, w : IWriter) + PerformCopy() XML Config IWriter IReader Keyboard + Read(c : char ) Video + Write () : char IoCContainer …
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. Separation of Concern Searching Booking Payment
  • 36.
  • 37.
  • 38. Crosscutting Concern Booking Payment Searching Security Logging AOP Booking Security Logging Payment Security Logging Searching Security Logging OOP Crosscutting Concerns Searching Booking Payment
  • 39. How it works… Object_B Object_A Object Oriented Flow
  • 40. How it works… Aspect Object_B Object_A advice Object Oriented Flow Aspect Oriented Flow pointcut = method_B Target Object = Object_B jointpoint = method invocation
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 49.