A class that is not there

 
event

Sometimes one feels like jumping overboard a bit. Just for fun. And if it does not hurt anybody, why not?

The topic of today’s jump is: I do not feel like creating a class. Am I completely crazy? Did I finally stop programming? No. And no, but you wish I had Smile with tongue out

The scenario is simple: an API layer, a bunch of services which request objects inherit from an interface that defines a handful of properties and the need of an implementation of that interface outside the context of the API.

I could have gone and created a class that implements the interface and be done with it. But a Friday is a day to do different things.

I had read about Clay and how it makes easier create dynamic objects and even shape them into typed interfaces. But when I installed its NuGet package, I did not feel at easy taking a transitive dependency on Castle.DynamicProxy.

What can I do? Would I fold and create a class myself? Never. Not in a Friday.

And then my neurons helped me out by remembering that I had read about another project, impromptu-interface, that might help me doing what I intended: exchange the 5 seconds of creating a class that implements an existing interface for a bit of Friday fun.

And it worked! With no dependencies.

NOTE: Now I can go back to do some more meaningful work with a smile on my face and the sense of achievement of having benefited from someone else’s code.