There are many ways to organize your automated tests. You can write unit tests, integration tests, end to end tests. The requirements depend on the product, of course, but I believe that the optimal solution is usually a mix of multiple methods.
Continue reading “Types of automated testing”Null object pattern and nullable reference types
I’ve been using the null object pattern recently to clean up some legacy code. It works really well with nullable reference types in C# and strict null checks in TypeScript.
Continue reading “Null object pattern and nullable reference types”What makes a senior developer?
There are many ways to classify software developer skill levels. Often you see developers being referred to as “junior” or “senior”. But these terms are not very well defined.
Continue reading “What makes a senior developer?”To ORM or not to ORM
Recently I’ve heard comments that developers want to simplify and remove abstractions, and ORM (object-relational mapper) is one of them. Having an ORM, usually Entity Framework in .NET, has been pretty much standard for years. But is this good or bad?
Continue reading “To ORM or not to ORM”Pair programming
We’ve been doing pair programming daily for almost 6 months. Here are my general thoughts.
Continue reading “Pair programming”Migrating from log4net to Serilog
I recently got excited about structured logging and decided to migrate from old log4net to Serilog. Adding more classification data to log events is something that will definitely benefit many applications. I tried to search for pros and cons, but it’s difficult to find a real world comparison for a large, complicated web application. Here are my experiences and opinions.
Continue reading “Migrating from log4net to Serilog”Builder pattern in C# with nested objects
I’ve used the builder pattern a lot recently for writing unit test setups, filling data into in-memory database. It can be used with nice fluent syntax too.
var document = new DocumentBuilder() .WithName("My document") .WithIcon("mydoc.png") .Build();
But what I’ve been trying to figure out, what’s the preferred way to do nested objects (or parent-child-relationships). Let’s say that I’m trying to build a document folder tree. I have folders, inside folders I have documents and sub-folders.
Continue reading “Builder pattern in C# with nested objects”Proper REST API design is hard
REST (Representational state transfer) is arguably the most popular architectural style for designing HTTP-based web APIs these days. While the basic idea is easy to understand, there’s a lot of corner cases that are not so straightforward. This has been on my mind lately while trying to revise the conventions for VocaDB’s REST API. It turns out that finding answers to some of these questions is difficult, and finding concrete examples of “proper” REST APIs that follow the conventions as precisely as possible is even more difficult. I decided to write something about the issues I’ve faced.
Transform object to another type in a LINQ query
I had the following problem: let’s say I have a class called “Song”. I want to load it from the database and transform it to a data transfer object class called “SongDto” which includes only a subset of the original Song class’s properties.
Continue reading “Transform object to another type in a LINQ query”
What’s good enough code quality?
Majority of programmers with some sense of pride would tell you they write the best possible code with uncompromising quality. Of course this isn’t true, and most of the time not even realistic. Unless you’re building software for a NASA space probe, aiming for ~90% perfect is probably the most cost effective.
My colleagues might consider me demanding (read: asshole) because I often criticize their code, but I’m not a compulsive perfectionist and I do settle for less than perfect solutions when it’s justified.