Today, we go to the Autofac container description, in my opinion this container is the best :) when it comes to the .NET platform. Using the autofac container we can use virtually all the advantages that containers give us.


Autofac gives us all the advantages that I mentioned in the previous article. We can forget in the beginning about our container that we wrote. He does not reach autofac to his feet :) let’s see what’s so interesting about autofac. Let’s start with the basic logging and creation of class instances.

I’m after a long break :) prepares for a presentation about CQRS, which will be recorded in Gdansk, I will post it on the blog :) And all the time work on the startup is boiling :) But let’s get to the point :) as promised in the previous article, next will be about these professional containers, it’s worth to use them because the possibilities are big :) We’re going :)


The question “Why not use my own container?” I answered in the previous article about containers in the introduction.

Just as I promised I would do another part about containers so I will keep my word. Here is the next part. Today with very useful tools, although some think that unnecessary (but this is a topic for another article), but we will dispel these doubts in this article. Ladies and gentlemen, get to know the containers :)


In the previous article we parted in a lot of stress :) But it was the intended effect, how tests can make the design more difficult … NOT TRUE !!! This results only through ignorance. We had three issues to solve.

  • Big constructors — if we had 10 dependencies in the GameServer class, and in each dependency, there would be a lot of other dependencies that would be completely unreadable, we would have to write everything from the finger, I wouldn’t like to do it …
  • We also wanted to remove the new word even from the client level which…

It was time for the second article (but it melancholy sounded :) ) in the previous article, we refactored the code of the web game prototype, and so on there you can still improve a lot, using mainly dependency injection what exactly in this article we will do, go :)


We already have the code of this game somewhat orderly and specific functionalities drawn for separate classes.

Before we go to the article, I would like to clarify the issues of character classes. One of the readers mentioned that the character classes are unnecessary, that it is better to do the functions because these classes only change their state and do not have a separate logic, he is right. …

We are continuing the dependency injection section, in this article we will refactorize the code from the previous entry and, as we remember, that code was not very friendly to read, test and expand. Today we will try to change it :)

First we have to refactorize this code to have what to inject, so you can come to the conclusion that we use a dependency injection to and satisfy solid rules, which means that dependency injection somehow suggests that we follow these rules.

At the beginning, let’s see how the classes of the characters have changed, namely the Thief, Mage, Barbarian and Paladin classes, and as we remember in that example, these classes inherit from the concrete class and should not. I dare even think they can not, amen.

I promised that in the next article we will already inject dependencies, however, I decided to do everything in turn, present the code on which we will work :)

I built a simple small application running in the console on which we will work through the entire dependency injection department, I specifically wrote it as if it would do a novice developer, i.e. how you can guess this code will be untestable and very unreadable, I will throw the code right away :)

It is an application or rather a web game prototype that first registers the user in the player database and later in this game we make our own character, I did not want to throw in some complicated example, some application that uses the map I…

Today’s post will be more written, no code will be because today I will only explain what is dependency injection, why it is, what it is for, etc. in the next post will be the code.

Talk about Dependency Injection

As someone once said, “Each of us will sooner or later hear the word SOLID, some of our friends will say that our code should be SOLID”

Dependency Injection is very much related to the last principle of dependency inversion, which “book version” sounds like this:

High-level modules should not depend on low-level modules — the relationships between them should result from abstraction.

Abstractions should not depend upon details. Details should depend upon abstractions.

Inversion of control is also a very important term related to Dependency Injection. Such my short explanatory rule inversion of control is “In the classic application…

I have not been here for a long time, mainly due to the lack of time and the topic to be discussed, but in the end the article is ready, as you guessed from the title the entry is the continuation of the first part about singleton because I thought that the first part is too poor :)


Hi everyone, after a long break in writing, there is a lot of material to describe and a lot has happened to me all this time 🙂 This article will be a continuation of the singleton, that is part two can be said, the first link is here I thought that the first part about singleton is too short and many issues related to the singleton is not explained, you have before you the second part of the singleton, which I think clearly explains the topic 🙂

We will also use unit tests today to demonstrate how they work…

Today we start the last of design patterns (in the end !!!), which is called Strategy at reading of this article before someone reaches the bottom of the article to the section “relations with other design patterns” will come to the conclusion that the Strategy pattern is very similar to the State pattern, however, they differ in purpose, but everything in turn :)


The main goal of the Strategy pattern is described in the picture below:

Today, about a fairly simple pattern called State, which serves to the very simple operation, as the name says to change the behavior of the object, when its internal state changes, i.e. when some event will happens, more accurately I will explain further in the article :)


In the simplest terms, the state pattern is that if the internal state of the object changes (we can rely on one of the variables of this object, eg on the bool type) from truth to false then we change the behavior of this object.

The most important elements in implementing this pattern are:

  • The Context class, which stores the current state of an object, overwrites this state and changes it.
  • An abstract State class that has defined abstract methods to change the state of an object.
  • The ConcreteState class, which inherits from the State class, implementing its methods which…

Sławomir Kowalski

Entrepreneur and software developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store