ericvruder.dk

C#, SQL, and good software design.

Abstractions, a developers perspective

Last time, we talked about abstraction in more general terms. We discussed what abstractions are and how they are used in the real world. We saw what the concept was about and discussed the different kinds of abstractions that exist. This time, we are going to look at it from a developers perspective and how Read more about Abstractions, a developers perspective[…]

The concept of abstraction, no code allowed

Abstractions are a central concept in software development. In my opinion, it is the most important concept to master, since it underpins everything that we do. Dependency injection would be very weak without it. Polymorphism wouldn’t exist. Unit testing would be borderline impossible. The software models themselves that we build are abstractions of the problem Read more about The concept of abstraction, no code allowed[…]

Test Data Builder Pattern

The test data builder pattern is a way of solving a pretty common problem when creating unit tests. When creating tests, you usually need to create test data to run on your system under test (sut). This can easily become unwieldy, when you need to take nested data into consideration. As you can see, it Read more about Test Data Builder Pattern[…]

Dependency injection in unit tests: Introducing Autofixture

Changing dependencies in your SUT (system under test) usually means that you have to revise all of your previous tests. This is because the default way of instantiating your SUT is newing one up and passing in any mocks it might need. This destroys test and code maintainability. Every time you make a change to Read more about Dependency injection in unit tests: Introducing Autofixture[…]

Thread pool starvation and the power of async/await

The first time I was ever introduced to the problem of thread pool starvation was by the great Sj√łkki Gummi Gau, a close colleague of mine and an amazing developer. He called me up and asked me to guess how long a program would take to run. It was a very simple program; it just Read more about Thread pool starvation and the power of async/await[…]

Mocking dependencies for more maintainable unit tests

Using a mocking framework in your unit tests will make your unit tests much shorter, much easier to comprehend, and much easier to maintain. In short, a good mocking framework is an absolutely must have tool in any developers toolkit. In this article, I will discuss what a mocking framework is and why it is Read more about Mocking dependencies for more maintainable unit tests[…]

Writing Testable Code, an Intro to Unit Testing

The art of writing testable code is not as easy as it seams. There are a lot of things you need to keep in mind just in order to create code that is actually testable. This is something we keep coming back to and probably something you encountered your self. “This code isn’t testable” is Read more about Writing Testable Code, an Intro to Unit Testing[…]

Logging best practices; or how to ruin your day off

Logging is a corner stone of any good application. Believe it or not, your program is going to fail, and it is going to fail hard. The only thing to save you here are the logs you created, in order to figure out exactly what went wrong and how to fix it. Believe me when Read more about Logging best practices; or how to ruin your day off[…]

Dependency Injection: Frameworks

As I mentioned in a previous article, there are multiple dependency injection frameworks our there for .net framework. Here, we will be talking a bit about the most popular ones and show very simple examples of how to get started with them and how to use them. This is not an exhaustive list! There are Read more about Dependency Injection: Frameworks[…]

Exceptions: Catch everything, handle nothing

When writing code, there is a certain feeling of importance with regards to one’s code. It should never stop. It should always execute to the end. It should not cast any exceptions, since my code can handle everything. Remember that a developers motto is “Everything is possible”. This leads to one of the biggest anti-patterns Read more about Exceptions: Catch everything, handle nothing[…]