I will start by saying that that I do not have anything new to add to the everlasting “dynamic vs static binding” debate: It’s been talked about to death at this point, and yeah, I am still well in the “strongly typed languages” camp and am not planning to leave anytime soon.
But that is not the point of this post.
It’s not a secret that I have been deeply entrenched into .NET for almost a decade now. But, only in the last couple of years I actually started enjoying all the new features to the .NET run-time and C# language language. Anonymous objects, the dynamic language run-time, value tuples, async and of course extensive type inference are just a few of them.
The biggest, shift for me personally, happened when I stopped caring/worrying about the “shape of data” I was using during the programming process. I know — sounds so vague that even I am not comfortable with this explanation What I mean is the fact that in a lot of cases, now, I do not have to care about the data type more than I need to. The compiler does take a lot of the grunt work out of the equation and leaves me to worry about the truly important things.
On the data and serialization side, I switched to JSON entirely. Popular libraries in .NET, combined with the DLR make object serialization a breeze. Instead of a ton of boilerplate types that never actually add any value, it’s a matter of using dynamic objects instead.
A quite lazy example, but illustrates somewhat my point:
... dynamic request = JsonConvert.DeserializeObject(buffer); ... var (result, details) = ProcessRequest(request); ...
At the end of the day, C# is definitely not a dynamic language, but it does borrow interesting concepts quite well and that gives people like me a pleasant and “safe” environment to work with.