Willy Wonka coded in .NET 4.x

Joseph Nielsen
4 min readMay 5, 2016

--

Chocolate waterfall for churning the chocolate. Makes sense.

Watching the Gene Wilder Willy Wonka, there was that moment when you saw the candy land with chocolate waterfall and your childhood imagination of endless cavities leapt for joy. Sure it was a little gratuitous, wasteful and maybe broke a few regulations related to hygiene and product safety- but that was before Augustus Gloop let himself fall into the river and get sucked up. But the chocolate waterfall did make intuitive sense, it was for churning chocolate milk. Of course!

What it looks like when you haven’t done DevOps properly

Then all of the later machines went from I sort of get this with the bubble fizz to the this doesn’t make any sense with the everlasting gobstopper- and the tunnel gave some nightmares- but I’m rambling. It was the world of imagination! Stop criticizing you maven!

Fast forward thirty years from the days when teachers’ used Willy Wonka as a teaching holiday tool, I’m now plugging away at refining some of the lessons I learned from my last project using .NET. I’ve invented all sorts of wonderful things. I have a repository pattern that uses generics to create a reusable repository for almost all of my Entity Framework classes (and the base repositories taste like snozberries). An Upserlete function that allows AutoMapper to recognize EntityFramework lazy loading children, avoiding the pesky errors you might otherwise get of trying to mistakenly recreate pre-existing child objects. I have authentication filters and claims transformers that aspect orient my security. I have IoC configurations! My goal is to create a simple scaffolding application that uses all these lessons learned but I start to think along the way, holy shark repellent batman this is a lot of code.

And then there’s React and Angular 2 now, I feel so old

So flash back a couple of weeks ago and the pragmatic programmer in me started embracing Node.js and MEAN.js for a little Hackathon we’re doing within our Slalom Application Development practice. We’re building a meeting room application that can be used on phones or wall touch panels. (Damn those meeting room squatters who refuse to be tortured by Outlook Calendar’s Iron Maiden of User Experience.) We’re making progress; I’ve created the seed scripts for Mongo and we’ve got our Yeoman mean.js scaffold. It only took me two hours to create the Mongo db seed scripts.

But I’m also working on refining these lessons learned from .NET so I think why not code the same application in .NET at the same time? Instead of two hours as well, it took me six hours to create the database project, schema, seed scripts and all that. Six hours because I think there’s something inherently soul sucking about taking the beautiful image that exists in your brain in the form of a JSON DTO and then breaking it down to third order form normalized tables. But I think, normalization and relational table structures preserve referential and data integrity. Then I remember how many databases I’ve seen over the years where RDBMS didn’t mean shee-yut for data integrity. (I’m always surprised when people aren’t aware of the 8k return record size limit in SQL Server.)

This is when it hits me, all these years I thought I was making beautiful systems in .NET I was really making another machine in Willy Wonka’s chocolate factory. Yes, they’re still wonderful machines- but they could’ve been a whole hell of a lot simpler and easier to code.

Of course, ASP.NET 5 is supposed to change all this

Now don’t get me wrong, debugging in .NET is super easy and will probably always be easier than debugging in Node. But if the rest of my MEAN.js hackathon project shapes out in the same way, I will forever look at Entity Framework, locking, AutoMapper, SQL Server and ASP.NET as inventions that were made to support the machine of the everlasting gobstopper.

--

--

Joseph Nielsen

I lead the software engineering and DevOps practice for Slalom, New Jersey. I enjoy building things, endurance running and all things DeepRacer.