Skip to content

Month: August 2019

DI is not IoC

Dependency Injection (DI) helps to enable Inversion of Control (IoC), but DI itself is not IoC because truly moving the locus of control outward requires an architecture that wraps and invokes the DI. An example of this would be ASP.NET MVC which uses DI to instantiate the controllers and other objects needed to process web requests. That is IoC, but the libraries that implement DI (“containers”) are not themselves IoC containers they are DI containers. Calling them IoC containers is inaccurate.

Leave a Comment

CyberPunk 2077

I am not a fanboy. I don’t get excited about upcoming games. But OMG I’ve been following CyberPunk 2077 for awhile and it now has a release date! April 2020! For the first time ever I think I’m going to have to pre-order a Collector’s Edition game!

I’ll explain. Way, way, way back in college (in the 1090s) I got introduced to the CyberPunk RPG and I loved it. Then the CyberPunk 2020 edition came out and it was even better. I played RPGs when I was young but nothing ever captivated me as much as CyberPunk. I even loved the novels set in the genre (it is stil, to this day, my favorite genre for books & movies).

I don’t play games all that often but The Witcher III from CD Projekt Red was one of the best I ever played. Then I found out that their next title would be CyberPunk 2077. They are basing it on the CyberPunk 2020 RPG and they have the author of that game on staff helping them develop it! I have never in my life been this interested in a video game.

And then I was watching the latest trailer / video of the game and it was just as awesome as the ones I had seen before. Right up to the point that Kenu Reves shows up in the video right at the end as a character! Have you ever seen Johnny Mnomonic?

So this is what it feels like to be a fanboy. For this, I’m okay with it.

https://www.cyberpunk.net/us/en/

CyberPunk 2077 @ Steam

Leave a Comment

The Service Locator Pattern

Developers keep referring to Service Locator as an anti-pattern. If that is the case then ASP.NET MVC and every IoC container I’ve ever seen must be wrong because they use it.

The interface for accessing an IoC container is an implementation of the Service Locator pattern. You’re asking for some particular interface (aka a service) and its giving you back an instance (if it can).

Under the hood ASP.NET MVC uses a service locator (which almost always happens to be an IoC container) to new-up Controllers for handling incoming HTTP requests.

Service Locators can certainly be used incorrectly or where they should not, but they are not an anti-pattern. They are a specific tool in what should be an immense toolbox for solving certain types of problems. Sometimes they are the best choice. Sometimes they are a terrible choice. But the pattern itself is not at fault.

For more read Service Locator vs Dependency-Injection which goes into more detail and is also a very fun read. I’d mention the author’s name, but I can’t seen to find a name associated with the blog.

Leave a Comment

Original Coder Libraries w/Layers Architecture

I’ve just pushed a new version of the Original Coder Libraries up to GitHub that includes the first draft of the Layers library and architecture.

The libraries are hosted on GitHub: The Original Coder Libraries

This push includes the first version of the Layers architectural library I’ve been working on. It is based on similar architectures I’ve used on a few different projects in the past which proved to be very helpful. From a features and maturity standpoint this could probably be considered the 3rd incarnation (once they are completed, still in alpha).

The library makes it incredibly easy and efficient to build software systems using layers. Especially systems that deal with data that need CRUD (Create, Read, Update and Delete) operations. Using the library it will be possible to implement a full set of CRUD endpoints for a resource (an entity / database table / or the like) in about 100 lines of code.

I’ve included a project named LayerApiMockup that provides an example of what setting up and implementing will be like with the library. It still needs a bit of work and I need to add the add-on libraries for implementing specific technologies (Entity Framework, ASP.NET MVC, etc) but this is a good start.

1 Comment
Site and all contents Copyright © 2019 James B. Higgins. All Rights Reserved.