SlideShare a Scribd company logo
1 of 28
An Event-Driven Approach
for the Separation of Concerns




        Hayim Makabee
    Yahoo! Labs Haifa, Israel
Separation of Concerns


Definition: Separation of Concerns


     A software system must be decomposed into parts that
     overlap in functionality as little as possible.




YAHOO! CONFIDENTIAL          -2-
Coupling and Cohesion


• Coupling: The degree of dependency between two
  modules.


• Cohesion: The measure of how strongly-related is the
  set of functions performed by a module.




YAHOO! CONFIDENTIAL       -3-
OOP and AOP


• OOP reduces coupling:
      – Encapsulation
      – Dynamic binding and polymorphism


• AOP increases cohesion:
      – Separates cross-cutting concerns




YAHOO! CONFIDENTIAL              -4-
Event-Driven Programming (EDP)


• Reactive Systems are essentially event-driven.


• Hybrid systems use EDP only to implement a specific
  part of their functionality:
      – Graphical User Interface
      – Publish-Subscribe
      – Observer pattern


• In general EDP is not used to separate concerns. It is a
  modelling tool.

YAHOO! CONFIDENTIAL                -5-
EDP and the Separation of Concerns


• Our claim: EDP should be adopted as an alternative tool
  for the Separation of Concerns.


• An EDP approach can be used to reduce coupling and
  increase cohesion.


• Should be based on the explicit definition of Events and
  Event Handlers.




YAHOO! CONFIDENTIAL         -6-
The EventJ Framework


• Events:
      – Immutable objects.
      – Have state and getter functions.
      – Have type and are organized in an inheritance hierarchy.




YAHOO! CONFIDENTIAL                -7-
EventHandlers


• EventHandlers:
      – Execute some action in response to an Event.
      – May subscribe to different types of Events.
      – May be stateless or stateful.
      – May trigger Events themselves.
      – Receive Events asynchronously.
      – Do not depend on the results of other EventHandlers.
      – Run on their own threads.
      – Manage their own queue of Events.



YAHOO! CONFIDENTIAL                 -8-
Event Dispatcher


• EventDispatcher:
      – Singleton.
      – Propagates Events to the appropriate EventHandlers.
      – Events are initially stored in the EventDispatcher’s central
        queue.
      – Each Event is asynchronously propagated to all the
        EventHandlers that have subscribed to its type.
      – EventHandlers call the EventDispatcher to subscribe to Event
        types.
      – The EventDispatcher runs on a separate thread.



YAHOO! CONFIDENTIAL                 -9-
Separating Concerns with Events
• Identification: Identify the concerns that may be
  separated from the main functionality (specific pieces of
  code that can be moved to some other module).


• Triggering: For each concern, define an appropriate
  type of Event and insert the triggering of this Event in
  the suitable places in the code.


• Handling: For each type of Event, implement the
  associated EventHandler(s). Explicitly separate the
  pieces of code from the Identification step and move
  them to the respective handlers.
YAHOO! CONFIDENTIAL          - 10 -
Pre-Conditions to Separate Concerns


• Concurrency: Since Events are handled
  asynchronously, it must be possible to execute this
  separated piece of code in parallel with the rest of the
  original code.


• Non-dependency: Since EventHandlers should not
  modify any external data, the execution of the original
  code must not depend on the results of the execution of
  the piece of code that was separated.



YAHOO! CONFIDENTIAL          - 11 -
Example: An Instant-Messaging System


• Each user has a list of contacts (friends).
• Must know who among his contacts is available to chat.
• The system must manage the user status.
• Whenever there is a change in this status the system
  must notify all his contacts that are currently online.
• Uses a subscription model, in which each online user is
  subscribed to all his friends.




YAHOO! CONFIDENTIAL          - 12 -
Login and Logout
Login(User u)
{
     u.SetStatus(Online);
     NotificationMgr.NotifyContacts(u);
     SubscriptionMgr.SubscribeContacts(u);
}


Logout(User u)
{
     u.SetStatus(Offline);
     NotificationMgr.NotifyContacts(u);
     SubscriptionMgr.UnsubscribeContacts(u);
}



YAHOO! CONFIDENTIAL            - 13 -
Timeout

Timeout(User u)
{
     u.SetStatus(Offline);
     NotificationMgr.NotifyContacts(u);
     SubscriptionMgr.UnsubscribeContacts(u);
}




YAHOO! CONFIDENTIAL            - 14 -
Separating Cross-cutting Concerns with Events
Login(User u)
{
     u.SetStatus(Online);
}


Logout(User u)
{
     u.SetStatus(Offline);
}


Timeout(User u)
{
     u.SetStatus(Offline);
}

YAHOO! CONFIDENTIAL          - 15 -
User

User.SetStatus(Status status)
{
     this.status = status;
     EventDispatcher.Trigger(new UserStatusChangedEvent(this));
}




YAHOO! CONFIDENTIAL             - 16 -
Handlers

NotificationHandler.Handle(UserStatusChangedEvent e)
{
     NotificationMgr.NotifyContacts(e.getUser());
}


SubscriptionHandler.Handle(UserStatusChangedEvent e)
{
     if (e.getUser().isOnline()) {
              SubscriptionMgr.SubscribeContacts(e.getUser());
     } else {
              SubscriptionMgr.UnsubscribeContacts(e.getUser());
     }
}

YAHOO! CONFIDENTIAL                - 17 -
Comparison: EDP vs. AOP


• Encapsulation
• Inheritance
• Coupling
• Order of Execution
• Invocation
• Extensibility
• Reusability
• Concurrency


                       - 18 -
Encapsulation


Encapsulation:
• EDP does not violate encapsulation. Event Handlers
  have no access to the data members of other classes.


• AOP allows the violation of encapsulation. An advice
  may change the value of any variable anywhere in the
  code.




YAHOO! CONFIDENTIAL        - 19 -
Inheritance


Inheritance:
• EDP can use inheritance. Event types and
  EventHandlers can be organized in hierarchies.


• AOP does not use inheritance. Pointcuts cannot be
  organized in a hierarchy, since they are defined by
  name. Aspects cannot inherit from other aspects.




YAHOO! CONFIDENTIAL         - 20 -
Coupling


Coupling:
• EDP supports coupling by type. An EventHandler is
  coupled to a type of Event.


• AOP allows coupling by name. An aspect can execute
  over a specific function or variable, by name. If the
  name of this variable is changed, the aspect must be
  changed as well.




YAHOO! CONFIDENTIAL        - 21 -
Order of Execution


Order of Execution:
• EDP uses EventHandlers which are executed
  asynchronously and in no particular order, since their
  execution should be independent of each other and
  should not directly affect the rest of the system.


• AOP has aspects whose execution order is not well-
  defined and thus if several aspects execute as a
  consequence of the same code, the results may be
  unpredictable.


YAHOO! CONFIDENTIAL         - 22 -
Invocation


Invocation:
• EDP is based on explicit invocations. The Events are
  triggered explicitly. For each method it is possible to
  know which Events are triggered by it, and for each
  Event type it is clear which EventHandlers handle it.


• AOP uses implicit invocations. By observing a piece of
  code there is nothing that indicates that an aspect may
  be executed. Given an aspect, it is hard to find in the
  system all pieces of code affected by it.


YAHOO! CONFIDENTIAL          - 23 -
Extensibility


Extensibility:
• EDP makes it easy to add a new EventHandler for some
  existing Event type or to trigger an Event of an existing
  type in some new function.


• AOP is not easily extensible. If a new advice must be
  added to some existing pointcut it is necessary to repeat
  the pointcut definition in a new aspect. If we want to
  extend an advice to be applied to more pointcuts, it is
  necessary to change the code of the original aspect.


YAHOO! CONFIDENTIAL         - 24 -
Reusability


Reusability:
• EDP supports reusability of Events and EventHandlers.
  Handlers are modular and reusable since they are
  coupled to Event types, and are independent of the rest
  of the system.


• AOP defines aspects which have small potential for
  reuse in other systems, since they are coupled to
  functions and variables by name.



YAHOO! CONFIDENTIAL        - 25 -
Concurrency


Concurrency:
• EDP supports EventHandlers that can be executed in
  parallel, since they are encapsulated and do not affect
  code outside them.


• AOP does not support concurrency. Advices cannot be
  executed in parallel. Their execution must be serialized
  since they can potentially affect the same piece of code.




YAHOO! CONFIDENTIAL         - 26 -
Conclusions


• We proposed the adoption of an Event-Driven approach
  for the Separation of Concerns.
      – Methodology to identify cross-cutting concerns and separate
        them using events and event handlers.
      – Defined pre-requisites to perform this change.
      – Presented concrete example using the EventJ framework.
      – Compared our approach with AOP.




YAHOO! CONFIDENTIAL                - 27 -
Thank You!


    - 28 -

More Related Content

What's hot

Software prototyping
Software prototypingSoftware prototyping
Software prototypingBirju Tank
 
Software development methodologies
Software development methodologiesSoftware development methodologies
Software development methodologiesAnkita Lachhwani
 
To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...Hayim Makabee
 
OO Development 2 - Software Development Methodologies
OO Development 2 - Software Development MethodologiesOO Development 2 - Software Development Methodologies
OO Development 2 - Software Development MethodologiesRandy Connolly
 
Software Engineering - Software Models
Software Engineering - Software ModelsSoftware Engineering - Software Models
Software Engineering - Software ModelsReddhi Basu
 
Software Development Methodologies
Software Development MethodologiesSoftware Development Methodologies
Software Development MethodologiesNicholas Davis
 
Introduction To Software Engineering
Introduction To Software EngineeringIntroduction To Software Engineering
Introduction To Software EngineeringLeyla Bonilla
 
Six Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower ScientistsSix Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower ScientistsDavid De Roure
 
Requirement Gathering & Rapid Prototyping
Requirement Gathering & Rapid PrototypingRequirement Gathering & Rapid Prototyping
Requirement Gathering & Rapid PrototypingAurobindo Nayak
 
Prototype model
Prototype modelPrototype model
Prototype modelshuisharma
 
Architecture In An Agile World
Architecture In An Agile WorldArchitecture In An Agile World
Architecture In An Agile WorldJames Cooper
 
Software engineering note
Software engineering noteSoftware engineering note
Software engineering noteNeelamani Samal
 
Unit 2 SEPM_ Requirement Engineering
Unit 2 SEPM_ Requirement EngineeringUnit 2 SEPM_ Requirement Engineering
Unit 2 SEPM_ Requirement EngineeringKanchanPatil34
 
Invincible React States with Domain Driven Design
Invincible React States with Domain Driven Design Invincible React States with Domain Driven Design
Invincible React States with Domain Driven Design Prateek
 
Software Engineering - Lecture 02
Software Engineering - Lecture 02Software Engineering - Lecture 02
Software Engineering - Lecture 02Asifuzzaman Hridoy
 

What's hot (20)

Software prototyping
Software prototypingSoftware prototyping
Software prototyping
 
Software development methodologies
Software development methodologiesSoftware development methodologies
Software development methodologies
 
To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...
 
Agile Development
Agile DevelopmentAgile Development
Agile Development
 
OO Development 2 - Software Development Methodologies
OO Development 2 - Software Development MethodologiesOO Development 2 - Software Development Methodologies
OO Development 2 - Software Development Methodologies
 
Software Engineering Practice
Software Engineering PracticeSoftware Engineering Practice
Software Engineering Practice
 
Software Engineering - Software Models
Software Engineering - Software ModelsSoftware Engineering - Software Models
Software Engineering - Software Models
 
Software Development Methodologies
Software Development MethodologiesSoftware Development Methodologies
Software Development Methodologies
 
Introduction To Software Engineering
Introduction To Software EngineeringIntroduction To Software Engineering
Introduction To Software Engineering
 
Six Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower ScientistsSix Principles of Software Design to Empower Scientists
Six Principles of Software Design to Empower Scientists
 
Requirement Gathering & Rapid Prototyping
Requirement Gathering & Rapid PrototypingRequirement Gathering & Rapid Prototyping
Requirement Gathering & Rapid Prototyping
 
Prototyping
PrototypingPrototyping
Prototyping
 
Prototype model
Prototype modelPrototype model
Prototype model
 
Architecture In An Agile World
Architecture In An Agile WorldArchitecture In An Agile World
Architecture In An Agile World
 
Software engineering note
Software engineering noteSoftware engineering note
Software engineering note
 
Unit 2 SEPM_ Requirement Engineering
Unit 2 SEPM_ Requirement EngineeringUnit 2 SEPM_ Requirement Engineering
Unit 2 SEPM_ Requirement Engineering
 
Invincible React States with Domain Driven Design
Invincible React States with Domain Driven Design Invincible React States with Domain Driven Design
Invincible React States with Domain Driven Design
 
7 5-94-101
7 5-94-1017 5-94-101
7 5-94-101
 
Software Engineering - Lecture 02
Software Engineering - Lecture 02Software Engineering - Lecture 02
Software Engineering - Lecture 02
 
PROTOTYPING
PROTOTYPINGPROTOTYPING
PROTOTYPING
 

Viewers also liked

July 2013 Talk, What Industry Needs from Architecture Description Languages
July 2013 Talk, What Industry Needs from Architecture Description LanguagesJuly 2013 Talk, What Industry Needs from Architecture Description Languages
July 2013 Talk, What Industry Needs from Architecture Description Languagesgrossd18
 
Aliyah: Looking for a hi-tech job in Israel
Aliyah: Looking for a hi-tech job in IsraelAliyah: Looking for a hi-tech job in Israel
Aliyah: Looking for a hi-tech job in IsraelHayim Makabee
 
Introduction to Event Sourcing and CQRS (IASA-IL)
Introduction to Event Sourcing and CQRS (IASA-IL)Introduction to Event Sourcing and CQRS (IASA-IL)
Introduction to Event Sourcing and CQRS (IASA-IL)Vladik Khononov
 
Agile archiecture iltam 2014
Agile archiecture   iltam 2014Agile archiecture   iltam 2014
Agile archiecture iltam 2014Dani Mannes
 
Designing with tests
Designing with testsDesigning with tests
Designing with testsDror Helper
 
Adaptive Object Model - IASA IL Meeting on Software Evolution (3/2014)
Adaptive Object Model - IASA IL Meeting on Software Evolution  (3/2014)Adaptive Object Model - IASA IL Meeting on Software Evolution  (3/2014)
Adaptive Object Model - IASA IL Meeting on Software Evolution (3/2014)Atzmon Hen-Tov
 
Watch-It-Next: A Contextual TV Recommendation System
Watch-It-Next: A Contextual TV Recommendation SystemWatch-It-Next: A Contextual TV Recommendation System
Watch-It-Next: A Contextual TV Recommendation SystemRaz Nissim
 
Extracting Quality Scenarios from Functional Scenarios
Extracting Quality Scenarios from Functional ScenariosExtracting Quality Scenarios from Functional Scenarios
Extracting Quality Scenarios from Functional ScenariosProf. Amir Tomer
 
Antifragile Software Design
Antifragile Software DesignAntifragile Software Design
Antifragile Software DesignHayim Makabee
 
Reducing Technical Debt
Reducing Technical DebtReducing Technical Debt
Reducing Technical DebtHayim Makabee
 
The five expertise of a software architect
The five expertise of a software architectThe five expertise of a software architect
The five expertise of a software architectLior Bar-On
 
The Role of the Software Architect (short version)
The Role of the Software Architect (short version)The Role of the Software Architect (short version)
The Role of the Software Architect (short version)Hayim Makabee
 
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkTaming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkJoseph Yoder
 
Software Quality Attributes
Software Quality AttributesSoftware Quality Attributes
Software Quality AttributesHayim Makabee
 
The SOLID Principles Illustrated by Design Patterns
The SOLID Principles Illustrated by Design PatternsThe SOLID Principles Illustrated by Design Patterns
The SOLID Principles Illustrated by Design PatternsHayim Makabee
 
The Role of the Software Architect
The Role of the Software ArchitectThe Role of the Software Architect
The Role of the Software ArchitectHayim Makabee
 
Tdd 4 everyone full version
Tdd 4 everyone full versionTdd 4 everyone full version
Tdd 4 everyone full versionLior Israel
 

Viewers also liked (17)

July 2013 Talk, What Industry Needs from Architecture Description Languages
July 2013 Talk, What Industry Needs from Architecture Description LanguagesJuly 2013 Talk, What Industry Needs from Architecture Description Languages
July 2013 Talk, What Industry Needs from Architecture Description Languages
 
Aliyah: Looking for a hi-tech job in Israel
Aliyah: Looking for a hi-tech job in IsraelAliyah: Looking for a hi-tech job in Israel
Aliyah: Looking for a hi-tech job in Israel
 
Introduction to Event Sourcing and CQRS (IASA-IL)
Introduction to Event Sourcing and CQRS (IASA-IL)Introduction to Event Sourcing and CQRS (IASA-IL)
Introduction to Event Sourcing and CQRS (IASA-IL)
 
Agile archiecture iltam 2014
Agile archiecture   iltam 2014Agile archiecture   iltam 2014
Agile archiecture iltam 2014
 
Designing with tests
Designing with testsDesigning with tests
Designing with tests
 
Adaptive Object Model - IASA IL Meeting on Software Evolution (3/2014)
Adaptive Object Model - IASA IL Meeting on Software Evolution  (3/2014)Adaptive Object Model - IASA IL Meeting on Software Evolution  (3/2014)
Adaptive Object Model - IASA IL Meeting on Software Evolution (3/2014)
 
Watch-It-Next: A Contextual TV Recommendation System
Watch-It-Next: A Contextual TV Recommendation SystemWatch-It-Next: A Contextual TV Recommendation System
Watch-It-Next: A Contextual TV Recommendation System
 
Extracting Quality Scenarios from Functional Scenarios
Extracting Quality Scenarios from Functional ScenariosExtracting Quality Scenarios from Functional Scenarios
Extracting Quality Scenarios from Functional Scenarios
 
Antifragile Software Design
Antifragile Software DesignAntifragile Software Design
Antifragile Software Design
 
Reducing Technical Debt
Reducing Technical DebtReducing Technical Debt
Reducing Technical Debt
 
The five expertise of a software architect
The five expertise of a software architectThe five expertise of a software architect
The five expertise of a software architect
 
The Role of the Software Architect (short version)
The Role of the Software Architect (short version)The Role of the Software Architect (short version)
The Role of the Software Architect (short version)
 
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkTaming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
 
Software Quality Attributes
Software Quality AttributesSoftware Quality Attributes
Software Quality Attributes
 
The SOLID Principles Illustrated by Design Patterns
The SOLID Principles Illustrated by Design PatternsThe SOLID Principles Illustrated by Design Patterns
The SOLID Principles Illustrated by Design Patterns
 
The Role of the Software Architect
The Role of the Software ArchitectThe Role of the Software Architect
The Role of the Software Architect
 
Tdd 4 everyone full version
Tdd 4 everyone full versionTdd 4 everyone full version
Tdd 4 everyone full version
 

Similar to An Event-Driven Approach for the Separation of Concerns

Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN ControllerSumit Arora
 
Workflows via Event driven architecture
Workflows via Event driven architectureWorkflows via Event driven architecture
Workflows via Event driven architectureMilan Patel
 
ANET SureLog International Edition Main Advantages
ANET SureLog International Edition Main AdvantagesANET SureLog International Edition Main Advantages
ANET SureLog International Edition Main AdvantagesMurat Korucu
 
3. 2 req elicitation activities
3. 2  req elicitation activities3. 2  req elicitation activities
3. 2 req elicitation activitiesAshenafi Workie
 
Mock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion PrincipleMock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion PrincipleP Heinonen
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Patternjeetendra mandal
 
Building Event Driven Systems
Building Event Driven SystemsBuilding Event Driven Systems
Building Event Driven SystemsWSO2
 
Agile in Medical Software Development
Agile in Medical Software DevelopmentAgile in Medical Software Development
Agile in Medical Software DevelopmentBernhard Kappe
 
Dependency injection and inversion
Dependency injection and inversionDependency injection and inversion
Dependency injection and inversionchhabraravish23
 
Chapter 1-Object Oriented Software Engineering.pptx
Chapter 1-Object Oriented Software Engineering.pptxChapter 1-Object Oriented Software Engineering.pptx
Chapter 1-Object Oriented Software Engineering.pptxaroraritik30
 
System Accidents: Understanding Common Accidents
System Accidents: Understanding Common AccidentsSystem Accidents: Understanding Common Accidents
System Accidents: Understanding Common AccidentsGalen Emery, CISSP
 
RTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.pptRTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.pptShashikanth
 
Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...
Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...
Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...Chris Hammerschmidt
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...
POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...
POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...Liming Zhu
 
PCI and Vulnerability Assessments - What’s Missing
PCI and Vulnerability Assessments - What’s MissingPCI and Vulnerability Assessments - What’s Missing
PCI and Vulnerability Assessments - What’s MissingBlack Duck by Synopsys
 

Similar to An Event-Driven Approach for the Separation of Concerns (20)

Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 
Workflows via Event driven architecture
Workflows via Event driven architectureWorkflows via Event driven architecture
Workflows via Event driven architecture
 
ANET SureLog International Edition Main Advantages
ANET SureLog International Edition Main AdvantagesANET SureLog International Edition Main Advantages
ANET SureLog International Edition Main Advantages
 
SureLog SIEM
SureLog SIEMSureLog SIEM
SureLog SIEM
 
Sure log full
Sure log fullSure log full
Sure log full
 
3. 2 req elicitation activities
3. 2  req elicitation activities3. 2  req elicitation activities
3. 2 req elicitation activities
 
Mock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion PrincipleMock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion Principle
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Pattern
 
Software Engineering CSE/IT.pptx
 Software Engineering CSE/IT.pptx Software Engineering CSE/IT.pptx
Software Engineering CSE/IT.pptx
 
Building Event Driven Systems
Building Event Driven SystemsBuilding Event Driven Systems
Building Event Driven Systems
 
Agile in Medical Software Development
Agile in Medical Software DevelopmentAgile in Medical Software Development
Agile in Medical Software Development
 
Dependency injection and inversion
Dependency injection and inversionDependency injection and inversion
Dependency injection and inversion
 
Chapter 1-Object Oriented Software Engineering.pptx
Chapter 1-Object Oriented Software Engineering.pptxChapter 1-Object Oriented Software Engineering.pptx
Chapter 1-Object Oriented Software Engineering.pptx
 
System Accidents: Understanding Common Accidents
System Accidents: Understanding Common AccidentsSystem Accidents: Understanding Common Accidents
System Accidents: Understanding Common Accidents
 
RTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.pptRTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.ppt
 
Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...
Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...
Machine Learning for (DF)IR with Velociraptor: From Setting Expectations to a...
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...
POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...
POD-Diagnosis: Error Detection and Diagnosis of Sporadic Operations on Cloud ...
 
PCI and Vulnerability Assessments - What’s Missing
PCI and Vulnerability Assessments - What’s MissingPCI and Vulnerability Assessments - What’s Missing
PCI and Vulnerability Assessments - What’s Missing
 

More from Hayim Makabee

Managing your Reputation
Managing your ReputationManaging your Reputation
Managing your ReputationHayim Makabee
 
Applications of Machine Learning - INDT Webinar
Applications of Machine Learning - INDT WebinarApplications of Machine Learning - INDT Webinar
Applications of Machine Learning - INDT WebinarHayim Makabee
 
Applications of Machine Learning
Applications of Machine LearningApplications of Machine Learning
Applications of Machine LearningHayim Makabee
 
Blue Ocean Strategy: KashKlik Use Case
Blue Ocean Strategy: KashKlik Use CaseBlue Ocean Strategy: KashKlik Use Case
Blue Ocean Strategy: KashKlik Use CaseHayim Makabee
 
Managing your Reputation Gvahim Webinar
Managing your Reputation Gvahim WebinarManaging your Reputation Gvahim Webinar
Managing your Reputation Gvahim WebinarHayim Makabee
 
Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)Hayim Makabee
 
Automated Machine Learning (Auto ML)
Automated Machine Learning (Auto ML)Automated Machine Learning (Auto ML)
Automated Machine Learning (Auto ML)Hayim Makabee
 
Managing your Reputation
Managing your ReputationManaging your Reputation
Managing your ReputationHayim Makabee
 
The Story of a Young Oleh (Immigrant in Israel)
The Story of a Young Oleh (Immigrant in Israel)The Story of a Young Oleh (Immigrant in Israel)
The Story of a Young Oleh (Immigrant in Israel)Hayim Makabee
 
Applications of Machine Learning
Applications of Machine LearningApplications of Machine Learning
Applications of Machine LearningHayim Makabee
 
To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...Hayim Makabee
 
Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...
Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...
Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...Hayim Makabee
 

More from Hayim Makabee (12)

Managing your Reputation
Managing your ReputationManaging your Reputation
Managing your Reputation
 
Applications of Machine Learning - INDT Webinar
Applications of Machine Learning - INDT WebinarApplications of Machine Learning - INDT Webinar
Applications of Machine Learning - INDT Webinar
 
Applications of Machine Learning
Applications of Machine LearningApplications of Machine Learning
Applications of Machine Learning
 
Blue Ocean Strategy: KashKlik Use Case
Blue Ocean Strategy: KashKlik Use CaseBlue Ocean Strategy: KashKlik Use Case
Blue Ocean Strategy: KashKlik Use Case
 
Managing your Reputation Gvahim Webinar
Managing your Reputation Gvahim WebinarManaging your Reputation Gvahim Webinar
Managing your Reputation Gvahim Webinar
 
Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)Explainable Machine Learning (Explainable ML)
Explainable Machine Learning (Explainable ML)
 
Automated Machine Learning (Auto ML)
Automated Machine Learning (Auto ML)Automated Machine Learning (Auto ML)
Automated Machine Learning (Auto ML)
 
Managing your Reputation
Managing your ReputationManaging your Reputation
Managing your Reputation
 
The Story of a Young Oleh (Immigrant in Israel)
The Story of a Young Oleh (Immigrant in Israel)The Story of a Young Oleh (Immigrant in Israel)
The Story of a Young Oleh (Immigrant in Israel)
 
Applications of Machine Learning
Applications of Machine LearningApplications of Machine Learning
Applications of Machine Learning
 
To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...
 
Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...
Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...
Reducing Technical Debt: Using Persuasive Technology for Encouraging Software...
 

Recently uploaded

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"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...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

An Event-Driven Approach for the Separation of Concerns

  • 1. An Event-Driven Approach for the Separation of Concerns Hayim Makabee Yahoo! Labs Haifa, Israel
  • 2. Separation of Concerns Definition: Separation of Concerns A software system must be decomposed into parts that overlap in functionality as little as possible. YAHOO! CONFIDENTIAL -2-
  • 3. Coupling and Cohesion • Coupling: The degree of dependency between two modules. • Cohesion: The measure of how strongly-related is the set of functions performed by a module. YAHOO! CONFIDENTIAL -3-
  • 4. OOP and AOP • OOP reduces coupling: – Encapsulation – Dynamic binding and polymorphism • AOP increases cohesion: – Separates cross-cutting concerns YAHOO! CONFIDENTIAL -4-
  • 5. Event-Driven Programming (EDP) • Reactive Systems are essentially event-driven. • Hybrid systems use EDP only to implement a specific part of their functionality: – Graphical User Interface – Publish-Subscribe – Observer pattern • In general EDP is not used to separate concerns. It is a modelling tool. YAHOO! CONFIDENTIAL -5-
  • 6. EDP and the Separation of Concerns • Our claim: EDP should be adopted as an alternative tool for the Separation of Concerns. • An EDP approach can be used to reduce coupling and increase cohesion. • Should be based on the explicit definition of Events and Event Handlers. YAHOO! CONFIDENTIAL -6-
  • 7. The EventJ Framework • Events: – Immutable objects. – Have state and getter functions. – Have type and are organized in an inheritance hierarchy. YAHOO! CONFIDENTIAL -7-
  • 8. EventHandlers • EventHandlers: – Execute some action in response to an Event. – May subscribe to different types of Events. – May be stateless or stateful. – May trigger Events themselves. – Receive Events asynchronously. – Do not depend on the results of other EventHandlers. – Run on their own threads. – Manage their own queue of Events. YAHOO! CONFIDENTIAL -8-
  • 9. Event Dispatcher • EventDispatcher: – Singleton. – Propagates Events to the appropriate EventHandlers. – Events are initially stored in the EventDispatcher’s central queue. – Each Event is asynchronously propagated to all the EventHandlers that have subscribed to its type. – EventHandlers call the EventDispatcher to subscribe to Event types. – The EventDispatcher runs on a separate thread. YAHOO! CONFIDENTIAL -9-
  • 10. Separating Concerns with Events • Identification: Identify the concerns that may be separated from the main functionality (specific pieces of code that can be moved to some other module). • Triggering: For each concern, define an appropriate type of Event and insert the triggering of this Event in the suitable places in the code. • Handling: For each type of Event, implement the associated EventHandler(s). Explicitly separate the pieces of code from the Identification step and move them to the respective handlers. YAHOO! CONFIDENTIAL - 10 -
  • 11. Pre-Conditions to Separate Concerns • Concurrency: Since Events are handled asynchronously, it must be possible to execute this separated piece of code in parallel with the rest of the original code. • Non-dependency: Since EventHandlers should not modify any external data, the execution of the original code must not depend on the results of the execution of the piece of code that was separated. YAHOO! CONFIDENTIAL - 11 -
  • 12. Example: An Instant-Messaging System • Each user has a list of contacts (friends). • Must know who among his contacts is available to chat. • The system must manage the user status. • Whenever there is a change in this status the system must notify all his contacts that are currently online. • Uses a subscription model, in which each online user is subscribed to all his friends. YAHOO! CONFIDENTIAL - 12 -
  • 13. Login and Logout Login(User u) { u.SetStatus(Online); NotificationMgr.NotifyContacts(u); SubscriptionMgr.SubscribeContacts(u); } Logout(User u) { u.SetStatus(Offline); NotificationMgr.NotifyContacts(u); SubscriptionMgr.UnsubscribeContacts(u); } YAHOO! CONFIDENTIAL - 13 -
  • 14. Timeout Timeout(User u) { u.SetStatus(Offline); NotificationMgr.NotifyContacts(u); SubscriptionMgr.UnsubscribeContacts(u); } YAHOO! CONFIDENTIAL - 14 -
  • 15. Separating Cross-cutting Concerns with Events Login(User u) { u.SetStatus(Online); } Logout(User u) { u.SetStatus(Offline); } Timeout(User u) { u.SetStatus(Offline); } YAHOO! CONFIDENTIAL - 15 -
  • 16. User User.SetStatus(Status status) { this.status = status; EventDispatcher.Trigger(new UserStatusChangedEvent(this)); } YAHOO! CONFIDENTIAL - 16 -
  • 17. Handlers NotificationHandler.Handle(UserStatusChangedEvent e) { NotificationMgr.NotifyContacts(e.getUser()); } SubscriptionHandler.Handle(UserStatusChangedEvent e) { if (e.getUser().isOnline()) { SubscriptionMgr.SubscribeContacts(e.getUser()); } else { SubscriptionMgr.UnsubscribeContacts(e.getUser()); } } YAHOO! CONFIDENTIAL - 17 -
  • 18. Comparison: EDP vs. AOP • Encapsulation • Inheritance • Coupling • Order of Execution • Invocation • Extensibility • Reusability • Concurrency - 18 -
  • 19. Encapsulation Encapsulation: • EDP does not violate encapsulation. Event Handlers have no access to the data members of other classes. • AOP allows the violation of encapsulation. An advice may change the value of any variable anywhere in the code. YAHOO! CONFIDENTIAL - 19 -
  • 20. Inheritance Inheritance: • EDP can use inheritance. Event types and EventHandlers can be organized in hierarchies. • AOP does not use inheritance. Pointcuts cannot be organized in a hierarchy, since they are defined by name. Aspects cannot inherit from other aspects. YAHOO! CONFIDENTIAL - 20 -
  • 21. Coupling Coupling: • EDP supports coupling by type. An EventHandler is coupled to a type of Event. • AOP allows coupling by name. An aspect can execute over a specific function or variable, by name. If the name of this variable is changed, the aspect must be changed as well. YAHOO! CONFIDENTIAL - 21 -
  • 22. Order of Execution Order of Execution: • EDP uses EventHandlers which are executed asynchronously and in no particular order, since their execution should be independent of each other and should not directly affect the rest of the system. • AOP has aspects whose execution order is not well- defined and thus if several aspects execute as a consequence of the same code, the results may be unpredictable. YAHOO! CONFIDENTIAL - 22 -
  • 23. Invocation Invocation: • EDP is based on explicit invocations. The Events are triggered explicitly. For each method it is possible to know which Events are triggered by it, and for each Event type it is clear which EventHandlers handle it. • AOP uses implicit invocations. By observing a piece of code there is nothing that indicates that an aspect may be executed. Given an aspect, it is hard to find in the system all pieces of code affected by it. YAHOO! CONFIDENTIAL - 23 -
  • 24. Extensibility Extensibility: • EDP makes it easy to add a new EventHandler for some existing Event type or to trigger an Event of an existing type in some new function. • AOP is not easily extensible. If a new advice must be added to some existing pointcut it is necessary to repeat the pointcut definition in a new aspect. If we want to extend an advice to be applied to more pointcuts, it is necessary to change the code of the original aspect. YAHOO! CONFIDENTIAL - 24 -
  • 25. Reusability Reusability: • EDP supports reusability of Events and EventHandlers. Handlers are modular and reusable since they are coupled to Event types, and are independent of the rest of the system. • AOP defines aspects which have small potential for reuse in other systems, since they are coupled to functions and variables by name. YAHOO! CONFIDENTIAL - 25 -
  • 26. Concurrency Concurrency: • EDP supports EventHandlers that can be executed in parallel, since they are encapsulated and do not affect code outside them. • AOP does not support concurrency. Advices cannot be executed in parallel. Their execution must be serialized since they can potentially affect the same piece of code. YAHOO! CONFIDENTIAL - 26 -
  • 27. Conclusions • We proposed the adoption of an Event-Driven approach for the Separation of Concerns. – Methodology to identify cross-cutting concerns and separate them using events and event handlers. – Defined pre-requisites to perform this change. – Presented concrete example using the EventJ framework. – Compared our approach with AOP. YAHOO! CONFIDENTIAL - 27 -
  • 28. Thank You! - 28 -