Exploring the Future Potential of AI-Enabled Smartphone Processors
PRDCW-avent-aggregator
1. AMIR BARYLKO
DECOUPLING
WITH THE
EVENT AGGREGATOR
2. WHO AM I?
• Quality Expert
• Architect
• Developer
• Mentor
• Great cook
• The one who’s entertaining you for the next hour!
Amir Barylko - Event Aggregator MavenThought Inc.
6. COUPLING
(WIKIPEDIA)
Degree to which
each program module relies
on each one
of the other modules
Amir Barylko - Event Aggregator MavenThought Inc.
7. COUPLING II
Is usually contrasted
with cohesion
Amir Barylko - Event Aggregator MavenThought Inc.
8. COUPLING III
Invented by Larry Constantine,
an original developer of
Structured Design
Amir Barylko - Event Aggregator MavenThought Inc.
9. COUPLING IV
Low coupling is often a
sign of a well-structured
computer system and a
good design
Amir Barylko - Event Aggregator MavenThought Inc.
10. COUPLING V
When combined with
high cohesion,
supports high
readability and
maintainability
Amir Barylko - Event Aggregator MavenThought Inc.
11. COHESION
(WIKIPEDIA)
measure of how
strongly-related the
functionality expressed by the
source code of a
software module is
Amir Barylko - Event Aggregator MavenThought Inc.
12. IS ALL ABOUT
DEPENDENCIES
Amir Barylko - Event Aggregator MavenThought Inc.
13. HARDCODED
DEPENDENCIES
public MovieLibrary()
{
this._storage = new LocalStorage();
this._critic = new JaySherman();
this._posterService = new IMDBPosterService();
}
very hard to test
and maintain!
Amir Barylko - Event Aggregator MavenThought Inc.
15. DEPENDENCY INJECTION
public MovieLibrary(IMovieStorage storage,
IMovieCritic critic,
IMoviePosterService posterService)
{
this._storage = storage;
this._critic = critic;
this._posterService = posterService;
}
Better for testing... but who
is going to initialize them?
Amir Barylko - Event Aggregator MavenThought Inc.
17. POOR’S MAN DI
public MovieLibrary()
{
this._storage = new LocalStorage();
this._critic = new JaySherman();
this._posterService = new IMDBPosterService();
}
Still testeable...
but smells!
Amir Barylko - Event Aggregator MavenThought Inc.
18. USING IOC CONTAINER
Container.Register(
Component
.For<IMovieCritic>()
.ImplementedBy<JaySherman>(),
Component
.For<IMoviePosterService>()
.ImplementedBy<IMDBPosterService>(),
Component
.For<IMovieStorage>()
.ImplementedBy<LocalStorage>());
Amir Barylko - Event Aggregator MavenThought Inc.
19. REFACTORING
What’s wrong?
Event Aggregator
Demo
Desktop &Web applications
Amir Barylko - Event Aggregator MavenThought Inc.
22. LET’S THINK
• Why the critic has to know the library (or
viceversa)?
• Or the poster service?
• If I need more services, do I add more
dependencies to the library?
Amir Barylko - Event Aggregator MavenThought Inc.
26. THE PATTERN
Channel events
from multiple
objects into a
single object to
s i m p l i f y
registration for
clients
Amir Barylko - Event Aggregator MavenThought Inc.
27. TRAITS
• Based on subject - observer
• Centralize event registration logic
• No need to track multiple objects
• Level of indirection
Amir Barylko - Event Aggregator MavenThought Inc.
32. WHAT?
NO CONCRETE EVENT?
• How can we get a concrete from an interface?
• Castle Dynamic Proxy!
•I have an interface and get a Proxy to a stub
• All properties are stubbed to be configured!
Amir Barylko - Event Aggregator MavenThought Inc.
37. TO FINALIZE
• Why EA reduces • How would it work with
complexity? web applications?
• What’s the difference with • What
about
Event Sourcing? WeakReferences?
• So, wouldthat mean we are • What about polymorphic
doing CQRS? event handling?
Amir Barylko - Event Aggregator MavenThought Inc.
38. RESOURCES
• Email: amir@barylko.com
• Twitter: @abarylko
• Slides and code: http://bit.ly/orthoslides
Amir Barylko - Event Aggregator MavenThought Inc.
39. RESOURCES II
•Coupling: http://bit.ly/yo5AK7
•Event Aggregator: http://bit.ly/zL1LrG
•MavenThought Commons: http://bit.ly/mt_commons
• Bootstrapper:http://bit.ly/xHNiKB
• Windsor Container:http://bit.ly/AmodqG
• Castle Dynamic Proxy: http://bit.ly/wihfid
Amir Barylko - Event Aggregator MavenThought Inc.
40. SOFTWARE QUALITY
WORKSHOP
• When: May 4, 10-11, 16-17
• More info: http://www.maventhought.com
Amir Barylko - Event Aggregator MavenThought Inc.