GithubHelp home page GithubHelp logo

domain-event's People

Contributors

juliendufresne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

domain-event's Issues

About domain event locator and event listener

From your code I see that after an event is raised, it must be handled by a particular event listener. And this event listener must be registered in domain event locator, or you wont be able to execute the event. By doing this, you have to manually register event listener at some point of your code, and this is cumbersome. As the application grows and multiple events need to be triggered, it becomes complex to add event listeners manually.

I was wondering, why do you need this behavior? Why cannot you just implement the handler method inside the event object itself, so users do not have to register event listeners manually? Or maybe, you can make it possible to enable easy mapping between each event and its handler(if you want event to be ignorant of how it will be handlered), so the event locator will automatically create an event listener object for each event(ie. map event PurchaseOrderCreated to event listener PurchaseOrderCreatedHandler).

This way, when you iterate through events and publish them through event bus, the event bus will use event locator to automatically map an event to its listener. You wont need to register event listener/handler manually anymore, the code becomes more concise.

Of course, registration of custom event listeners/handlers introduce more flexibility, so it can always be left of as an option. I just personally think that registering event listeners manually can be problematic as the application grows, and it's also confusing where should we register event listeners(in MVC controller, application service, repository?).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.