Hi Ben!

Glad you liked the article :)

You're right, reflection does lead to lower performance. I read somewhere it takes about x8 longer to instantiate objects and invoke methods using reflection.

Regarding maintenance, it guess it depends on which perspective you take on this.

This simple example is very easy to maintain, because all you do to add functionality, is to create new classes, these can then be tested separately as well.

You can achieve a similar result by using the Event Aggregate pattern.

This way, you'll have a single class, like the dispatcher, where you register events (or commands) and corresponding handlers.

You can use a dictionary for that.

I'll see if I can find the time to write an example of such approach.

Howcome you dislike IoC containers?

Software Developer Manager | Big4 ex. FinTech | Writer with +1M views. Sharing my opinion & what I learn. YT channel youtube.com/c/NicklasMillard

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store