Assignment 2: The Reflection Pattern. Using reflective
features of programming languages
This is one of the choices for Assignment 2.
MyEventBus
Objectives: Using reflective properties of programming languages - using Dynamic Invocation
Assignment 2: Using Reflective Languages: Build your own EventBus
In this assignment you implement your own EventBus (a greenrobot clone)
Also implement 2 event-driven applications that use your eventBus as an event infrastructure
Basic requirements
Implement an EventBus with an API similar to greenrobot but it must support only the default (POSTING) threadmode.
A subscriber will be identified by its handler method using the @MySubscriber annotation.
The two demo applications do not use any form of concurrency.
Bonus Requirements
Support also the ASYNC thread mode, which can be enabled by setting the threading attribute in the @MySubscriber annotation.
Demonstrate two applications that use asynchronous handlers.
Show how these applications ensure thread safety when handling events concurrently.
Deadlines and Grading
The deadline for this assignment is in Week 7. See the Grading Policy on CV for
PASSC and
DACSS.
Frameworks to use
Reflective languages: Java or C#
Resources
- Slides - Lecture notes weeks 4 and 5 link
- Source code of examples - Reflection in Java:
- The Java tutorials - The reflection API link
- MSDN - Reflection overview link