LEGO-manIn the video below, I am demonstrating what you may call the “heart” of Phosphorus.Five, which is a simple design pattern called Active Events.

This design pattern allows me to create 100% perfect encapsulation, in addition to run-time polymorphism. These two traits combined, allows me to dynamically link together functionality, projects and methods, in a way that traditional OOP has no mechanisms for.

If you wish to download my code, you can find it here.

Realize that in the above video, I am dynamically linking in an assembly with my console application, in such a way that my console app, has no knowledge about the implementation of my “foo” Active Event. Then afterwards, I “override” my “foo” Active Event, with another Active Event called “bar”.

If I was to use traditional OOP for achieving the same, then my console application would have to be statically linked towards my “plugin” assembly during compilation. In addition, I’d have to at the very least create an “interface”, where my console app would be dependent upon the signature of my methods from my interface.

In the above video though, I am able to replace this static linking, with a simple design pattern, that’s so easy and intuitive to understand, you’ll understand it before I can spell L-E-G-O …

This allows me to “orchestrate” functionality together, in C#, the same way you’d build a house from LEGO.