31 Aug 2021

Today, we’ll talk about an important question: how does the application database fit into the concept of Always-Valid Domain Model?

In other words, is the database part of the always-valid boundary or should you consider it an external system and validate all data coming from it?



27 Jul 2021

There’s an interesting controversy between two DDD topics: the Specification pattern and the Always-Valid domain model.



03 Jun 2021

Today, we’ll discuss an interesting use case of handling nulls in value objects. Should you put null inside the value objects themselves or decorate those value objects using the nullable reference type notation (? or Maybe)?



13 May 2021

<p><p>My new Pluralsight course about Validation and DDD went live.</p></p>



01 Apr 2021

Are static methods good or bad? Over the course of my career I did a full circle on this topic. In this article, I’ll try to describe this evolution and the reasoning behind it.



12 Jan 2021

UPDATE 5/13/2021: the course has been published, check it now here: Validation and DDD.

I’m working on a new Pluralsight course on the topic of validation and DDD, with the help of the FluentValidation library and .NET data annotations (attributes). So expect a couple of posts about validation in the near future.



08 Dec 2020

Today, we’ll discuss how to best handle unique constraint violations.



24 Nov 2020

Today, we’ll talk about the new C# 9 feature, Records, and whether or not they can be used as DDD value objects.

02 Nov 2020

I’m continuing the topic of domain model purity. Last time, we talked about domain model purity in the context of getting the current date and time. Today, we’ll discuss it with regards to lazy loading.



23 Sep 2020

I’m continuing the topic of domain model purity. This time, we’ll look at it with regards to getting the current date and time.

By the way, be sure to subscribe to my email list. Not all discussions fit the format of a blog post (including some shorter takes on the topic of domain model purity vs completeness). I send those out as emails instead.



04 Aug 2020

I’ve been meaning to write this article for a long time and, finally, here it is: the topic of domain model purity versus domain model completeness.



13 Jul 2020

This post is about where to put the equality comparison logic: under the test or production code.



24 Jun 2020

How to unit test an abstract class? Or a whole class hierarchy that depends on that abstract class? Let’s see.

08 Jun 2020

In this post, we’ll make a deep dive into the DRY and DAMP principles and will talk about the false dichotomy around them.



29 Apr 2020

Need to change validation rules but have pre-existing data that doesn’t follow the new rules? In this post, we’ll talk about how to do that properly.

15 Apr 2020

The use of mocks in unit testing is a controversial topic (maybe less so now than several years ago). I remember how, throughout my programming career, I went from mocking almost every dependency, to the "no-mocks" policy, and then to "only mock external dependencies".

None of this practices are good enough. In this article, I’ll show you which dependencies to mock, and which to use as is in your tests.

06 Apr 2020

In this article, we’ll review the types of unit testing dependencies. This is more of a reference article, to which I’ll be referring in future posts. Still, this topic is important for establishing the common vocabulary.



05 Mar 2020

My new online training course DDD and EF Core: Preserving Encapsulation went live.



04 Feb 2020

This article is about 3 things that can make or break any software project.



16 Dec 2019

In this post, we’ll talk about whether or not you should use assertion messages in tests.



25 Nov 2019

In this post, we’ll discuss an interesting question about whether the concepts of Entity and Value Object are the same.



28 Oct 2019

Combining bulk operations with Domain-Driven Design is a tough problem. In this article, we’ll look at why that is so and discuss ways to marry the two.

15 Oct 2019

This is a continuation of the article series about some more advanced error handling techniques.



23 Sep 2019

This post describes some (more) advanced error handling techniques. I’ll probably do a series because this topic is large and there’s quite a few things that need to be cleared out, but we’ll see.



22 Aug 2019

Giving your tests expressive names is important. Proper naming helps understand what the test verifies and how the underlying system behaves. In this post, we’ll take a look at a popular, yet inferior naming convention and see how it can be improved.



16 Jul 2019

I’m writing a book called Unit Testing: Principles, Patterns and Practices.



06 Jun 2019

This post describes a common problem: how to deal with multiple domain events if raising of one of them must negate the others.



15 Apr 2019

In this article, I’d like to discuss one particular aspect of exception handling relevant to CQRS and the decorator pattern.



20 Feb 2019

There’s a question that I didn’t cover in the course and that was raised at least twice since then: when to validate commands in CQRS?



31 Jan 2019

I published an online course about CQRS a couple months ago, and since then I realized that there are some topics I didn’t put enough emphasize on in that course, or didn’t cover at all. In the next several blog posts, I’m going to fill this gap.



24 Dec 2018

This article is a response to a reader’s question. The question posed an interesting problem that I think will be interesting to a wider audience.



06 Nov 2018

This is an article about how two DDD patterns contradict each other.



12 Oct 2018

My new online training course CQRS in Practice went live.



10 Sep 2018

In this article, we’ll talk about ORMs and lazy loading.



23 Jul 2018

Today, we’ll discuss the difference between identity in the DDD sense and database primary keys. We often mix the two together but are they really the same thing?



13 Jun 2018

UPDATE 3/5/2020: I’ve expanded on this article and updated its content for EF Core 3.1 in my new Pluralsight course DDD and EF Core: Preserving Encapsulation.

That was probably a long wait for those of you who follow my blog. But, better late than never, so here it is: another comparison of Entity Framework and NHibernate, in which I bash EF Core and present it as an unbiased review. Just kidding, I do try to be unbiased here to the best of my skills.



10 May 2018

Today’s article is an answer to a reader’s question about the use of Value Objects to represent the identity of an entity.



16 Apr 2018

This is the final post in my series about unit testing anti-patterns. This one is about non-determinism in tests.

09 Apr 2018

I’m continuing my unit testing anti-patterns article series. Today, we will talk about overriding methods in classes-dependencies.



28 Mar 2018

My new training course Domain-Driven Design: Working with Legacy Projects went live.

26 Mar 2018

Good news everyone! NHibernate 5.1 is released with the support of .NET Core 2.0 and .NET Standard 2.0.

19 Mar 2018

This is another post from my unit testing anti-patterns article series. Today, we will talk about code pollution.



20 Feb 2018

I haven’t done one of these for a while. This post is a review of a code submitted by a reader.

15 Feb 2018

I was asked a question recently which I find quite interesting. It is actually a part of a code review request (which I’ll cover next week) but I decided to elevate it to its own blog post.



30 Jan 2018

I’m continuing the series about unit testing anti-patterns I started a couple months ago. This article is about leaking domain knowledge to tests.

16 Jan 2018

To TDD or not to TDD? Is this question even relevant or maybe it’s enough to just write tests, no matter before the code or afterward? Let’s see.



11 Dec 2017

This news went mostly unnoticed but that’s actually a big one, at least for those of us who uses NHibernate as their primary ORM: NHibernate 5 now supports async IO bound operations.

04 Dec 2017

I got a suggestion recently about using .NET structs to represent DDD Value Objects to which I repeated what I’ve been saying and writing for several years now: structs are not a good choice for DDD Value Objects. But then I realized that I never actually dove into the details of why it is so.

So here it is, the blog post where we’ll talk about using .NET Value Types (structs) as DDD Value Objects and what effect it has on the domain model, performance, and mapping the model to the database using ORMs.



14 Nov 2017

My new training course Refactoring from Anemic Domain Model Towards a Rich One went live.

01 Nov 2017

Last time, we talked about making private methods public in order to enable unit testing. It’s not the only way people expose implementation details to the outside world for unit testing purposes, though. Today, we’ll look at a similar anti-pattern: exposing private state.



23 Oct 2017

I’m starting a new series about unit testing anti-patterns. This post is the first article in that series.

When it comes to unit testing, one of the most commonly asked questions is: how to test a private method?

03 Oct 2017

Today, I’d like to write about a simple and reliable way to implement domain events.



18 Sep 2017

In this post, I’m answering a reader’s question about how to combine an optimistic locking and automatic retry.



28 Aug 2017

This post is about a better implementation of Value Object.

17 Aug 2017

In this post, I’d like to talk about what I think is one of the most damaging attitudes a company or a person can have in the field of software development: short-sighted perspective.

07 Aug 2017

I’m back to the regular posting schedule. No more game development, at least for now.



26 Jul 2017

Final part of my story about game development. First part, second part. Client side load balancing In the previous post, I wrote about performance optimizations. We figured that a single 1 CPU server in Azure could handle up to 600 simultaneous users spread across 3 game scenes (also known as game arenas; each scene takes one OS process). Now we needed a mechanism for distributing the players across multiple servers and game scenes in those servers.

24 Jul 2017

Part 2 of my story. You can read the first part here. Working on the tank design I wrapped up the previous post by saying that we decided to change the game idea from robots to tanks. We refined our vision of the game. There were going to be multiple tank levels to introduce a sense of progression. When starting up, you’d have a tank with the least amount of health (hit point, HP) and fire power, and proceed to a tank of the highest level.

17 Jul 2017

If you read this blog regularly, you know that I usually write about DDD, functional programming, and enterprise software development best practices in general. These are the techniques I enjoy talking about, as well as applying them in my own projects. However, there was another field I always wanted to try myself in. That is game development. The ability to write my own games was the reason why I started learning to program in the first place. And I believe many programmers had this motivation behind their careers as well.

But let’s start from the beginning.

05 Jul 2017

This post is about how to work with information that is spread across multiple microservices.



28 Jun 2017

My new course Specification Pattern in C# for Pluralsight went live. Specification Pattern in C# This is a fairly short course (about an hour) which will teach you everything about the Specification Pattern and how to apply it in C# in combination with modern ORMs. From this course, you will learn: Use cases for the Specification Pattern. Common pitfalls people run into when implementing it.

15 Jun 2017

In this post, we’ll discuss Value Objects. Specifically, when to introduce them into your code.

07 Jun 2017

In this post, I’d like to talk about naming and Ubiquitous Language.

01 Jun 2017

This is the second code review session where I showcase a real-world code example. If you want to learn more about this new format, check out this post. You can also request a review yourself. To do that, use the form on this page. Code review: Fabric class The full source code of this one is rather large for a single blog post, so I decided to pick the most interesting portions of it - those I think could be improved.



24 May 2017

I apologize to everyone who’s waiting for my response to their code review requests. I was busy dealing with some personal stuff the last couple of weeks. Moving forward, I’m going to maintain a one post a week schedule where "regular" articles would take turns with code reviews. This article is a regular one, so the one next week would be a code review.

Today, I’d like to talk about IEnumerable and IReadOnlyList collection interfaces. We’ll discuss which of them is preferable and in what circumstance.

08 May 2017

In this post, we will explore a common design problem: implementing a Main Something property. There’s an equally common solution to this problem which is sub-optimal in most cases.

01 May 2017

This is the first code review where I showcase some real-world code example and nitpick suggest improvements in it. If you want to learn more about this new format, check out this post. You can also request a review yourself. To do that, use the form on this page. Code review: User Controller and error handling The code in question is a UserController class with this Create method: publicIActionResult Create([FromBody] UserCreateModeluser)



21 Apr 2017

When I started this blog, I had one idea in mind: create some sort of repository of programming principles and practices so that I myself and other people would have an easier time navigating around them. That’s a nice goal to aim for but I noticed that when it comes to the actual process of writing code, having such a repository is often not enough.

10 Apr 2017

This topic is partly covered in my Applying Functional Principles in C# Pluralsight course, Module 2. Here, I’d like to elaborate on how temporal coupling and immutability are related to each other. Temporal coupling Temporal coupling is coupling that occurs when there are two or more members of a class that need to be invoked in a particular order. A common example is the following: var calculator = new PriceCalculator(); calculator.



30 Mar 2017

This is a continuation of the topic of error handling. We’ll discuss what an exceptional situation in code actually is and see some examples of it.

13 Mar 2017

In this post, we’ll look at some practical examples of error handling. We will see whether it is better to use exceptions or the Result class to deal with errors.

02 Mar 2017

Today’s topic is about interfaces for repositories. Should you introduce them? Or maybe it’s better to use repositories as is? Let’s see.



16 Feb 2017

This post is about some bad practices in using automappers.



31 Jan 2017

Today, I’d like to talk about the (sometimes subtle) difference between 4xx and 5xx response codes when programming a RESTful API. I’ll try to show when to return what code (400 or 500) and introduce a simple way to implement this logic on the server side.

19 Jan 2017

This topic might seem trivial, especially if you look at all other articles that have beaten it to death already. But I would still like to make a couple of important points here. So, how long should a single method be?



23 Dec 2016

I already did this thing last year, so I thought I would do it again. Below is an overview of the articles I posted this year and a little bit of reflection on them. Retrospective It’s interesting to look at the progression of blogging topics throughout the whole year. They mostly followed the Pluralsight courses I was working on at the time. While writing a course, I remember finding lots of ideas that were worth extracting into a separate self-contained blog post.

08 Dec 2016

Today’s topic is about custom exception types. That is whether or not you should write your own exception types to throw in different situations.



28 Nov 2016

In this post, I want to cover the topic of OCP vs YAGNI - contradictions between the Open/Closed Principle and the You aren’t gonna need it one. OCP Let’s start with a refresher for what OCP is. The Open/Closed principle states that: Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. It was first introduced by Bertrand Meyer in his canonical Object-Oriented Software Construction book.

15 Nov 2016

Should you always mock out your database? Or should you include it in the unit/integration testing scope? What about other external systems? This post is based on my Pluralsight course about Pragmatic Unit Testing. Two types of external dependencies When it comes to external dependencies (dependencies outside the process that hosts your application, such as a database, a 3rd party system, etc.), there’s no single guideline regarding how to work with them in tests.

03 Nov 2016

Today’s topic is gonna be about OOP, FP, and object-relational impedance mismatch. The goal of this article is to show how object-oriented and functional paradigms deal with relational data stores.



26 Oct 2016

Last week I wrote about when to use mocks. In this post, I’d like to outline a specific guideline which comes into play when you start working with mocks: verifying collaborations at the system edges. This article is based on my recent Pluralsight course about Pragmatic Unit Testing. Verifying collaborations at the system edges The use of mocks goes hand in hand with the style of unit testing which I call collaboration verification.

10 Oct 2016

My new course Building a Pragmatic Unit Test Suite for Pluralsight went live. Building a Pragmatic Unit Test Suite Unit testing can be applied differently. Like many other things in programming, there are a lot of ways to mess up with it. It’s important to differentiate unit testing techniques that help bring confidence in your code base correctness from techniques that can potentially have a devastating effect on your entire test suite.

05 Oct 2016

In this post, I’ll show a simple way to get to know if your domain model is properly isolated.



29 Sep 2016

In this post, we’ll discuss the Law of Demeter in the context of immutability.

22 Sep 2016

Aggregates carry out many important functions. One of them is maintaining consistency boundaries. In this post, I write about the requirement of global email uniqueness and how it is related to aggregate invariants.

13 Sep 2016

Validation and DDD can be a tricky combination. How to perform validation in a way that doesn’t lead to domain knowledge leakage?

08 Sep 2016

In this post, we’ll take a look at domain services: what differs them from application services and when it is preferable to use one in addition to an application service.

02 Sep 2016

I’ve been using the term "domain model isolation" for a long time already but just recently realized that its meaning might not be as obvious as I thought. In this post, I’ll try to describe what it means to properly isolate your domain model and why it is important.



25 Aug 2016

In this post, I’ll write about a couple of thoughts regarding what domain logic is and how to distinguish it from other types of logic.

09 Aug 2016

In this post, we are going to look at what to do if you are not able to treat some concept in your domain as a Value Object and have to make it an Entity. TL;DR: create a nested Value Object inside that Entity and relocate as much domain logic to that Value Object as possible.

04 Aug 2016

I was reviewing the list of topic ideas lately and found this question in the discussion to my DDD in Practice Pluralsight course. While I answered it - somewhat briefly - in the discussion thread, I think it’s worth a separate detailed blog post. The question itself goes like this: "Can you have a collection of Value Objects abstracted as a Value Object itself?" Or, in other words, can you represent a collection as a Value Object?



27 Jul 2016

I bet you encounter (and use) the term "implementation detail" a lot. But what it means, exactly? And how to see if something is an implementation detail?

21 Jul 2016

This post is about the practice of Structural Inspection in unit testing and why I personally consider it an anti-pattern.

05 Jul 2016

This is a review of the Growing Object-Oriented Software, Guided by Tests book (GOOS for short) in which I’ll show how to implement the sample project from the book in a way that doesn’t require mocks to be tested. Growing Object-Oriented Software, Guided by Tests Without Mocks Let me first explain why I’m doing a review of this book. If you read this blog regularly, you probably noticed that I’m pretty much against using mocks in tests.



24 Jun 2016

I’ve created a NuGet package out of the functional extensions I wrote about in this post series and in my Pluralsight course. C# functional extensions NuGet library Thanks to one of the listeners of my Functional C# course, I finally made a separate NuGet package which is based on the Result class I wrote about awhile ago. The package contains the following classes: Result ResultExtensions

21 Jun 2016

The topic described in this article is part of my Unit Testing Pluralsight course. When trying to break down unit testing, the bigger picture stays incomplete if you overlook the subject of integration testing. In this post, we’ll discuss how to make the most out of your integration tests with pragmatic integration testing. Integration tests are tests that, unlike unit tests, work with some of the volatile dependencies directly (usually with the database and the file system).

15 Jun 2016

The topic described in this article is part of my Unit Testing Pluralsight course. This post is about pragmatic unit testing: how to get the most out of your unit test suite. Pragmatic unit testing: black-box vs white-box Pragmatic unit testing is about investing only in the tests that yield the biggest return on your effort. In the previous posts, we discussed what traits a valuable test possess (high chance of catching a regression, low chance of producing a false positive, fast feedback) and how various styles of unit testing (functional, state verification, collaboration verification) differ in terms of their value proposition.

09 Jun 2016

The topic described in this article is part of my Unit Testing Pluralsight course. In this post, I’ll describe different styles of unit testing and compare them in terms of their value proposition. Styles of unit testing and their value proposition There are 3 major styles of unit testing. The first one is functional, where you feed an input to the system under test (SUT) and check what output it produces:

08 Jun 2016

My new course Database Delivery Best Practices for Pluralsight went live. Database Delivery Best Practices Database delivery is still something many programmers struggle with. It’s not always clear how to deal with the database schema differences in different environments, how to resolve merge conflicts that inevitably arise when more than one programmer works with the DB, how to make sure you don’t break the other teams' applications when you refactor the database structure and so on.

01 Jun 2016

The topic described in this article is part of my Unit Testing Pluralsight course. I’m starting a new series which will be devoted to the topic of unit testing. In it, I’ll try to define what a valuable test is and show how the use of mocks fits into this picture. I’ll also describe the approach that I think has the best return of investments in terms of the value it provides.



21 May 2016

This post is a review of some talks from NDC London 2016 that I found interesting.

12 May 2016

The topic of immutable architecture described here is part of my Applying Functional Principles in C# Pluralsight course. In this post, I’d like to show a common approach to introducing immutability to your code base on an architectural level. Immutability, State, and Side Effects Before we start, let’s take a minute to define the terms. Most likely, you have already encountered them but I want to make sure we are on the same page here.

04 May 2016

This post is a showcase for the Singleton design pattern. In contrast to the common belief, Singleton is not inherently bad and I’ll try to show you in what circumstances it is a good choice.



27 Apr 2016

In this post, I want to take a closer look at the practice of defensive programming.

21 Apr 2016

The topic of functional programming described here is a part of my Applying Functional Principles in C# Pluralsight course. In this article, I’ll try to answer the question: what is functional programming? Functional programming So, what is functional programming? This term arises quite often and every author writing about it gives their own explanation. I’m no exception. In my opinion, the simplest and at the same time precise definition is the following: functional programming is programming with mathematical functions.

11 Apr 2016

My new course Applying Functional Principles in C# for Pluralsight went live. Applying Functional Principles in C# What interesting about functional programming is that it allows you to adhere to the most important software development principles, just as the DDD practices do. It helps reduce the cognitive load when you deal with your code base and thus keep your software maintainable in a long term. This course is based on the article series I posted awhile back.

05 Apr 2016

In this post, I’d like to write about a pretty common discussion in DDD circles: should one have the domain model separated from the persistence model? In other words, should you map your domain objects to the DB tables directly using an ORM or would it be better to use a separate set of Data Access Objects (DAOs) instead?



24 Mar 2016

In this post, I’d like to write about the personal traits we all possess. Namely, I want to talk about being proud of your code and trying to impress people with it.

17 Mar 2016

In this article, I’d like to write about a powerful technique that can potentially save you a lot of work and make your code much more concise: representing reference data as code.

08 Mar 2016

In this post, I write about 2 ways of representing a link to an aggregate.



29 Feb 2016

In this post, I’d like to talk about a mechanical approach to domain modeling. It sometimes arises when teams start applying Domain-Driven Design (DDD) principles to their projects and when they don’t have enough experience with it yet.

22 Feb 2016

The topic described in this article is a part of my Domain-Driven Design in Practice Pluralsight course. In this post, I’d like to talk about the partially initialized entities anti-pattern: anti-pattern that is often used in conjunction with repositories. Partially initialized entities Partially initialized entities are entities which are not fully constructed and returned as a result of some operation, usually an operation of fetching them from the database.

16 Feb 2016

Code correctness verification is not an easy task. At the same time, it’s one of the most important problems we have when we build software projects. In this article, I’ll compare 3 different ways of achieving code correctness.

08 Feb 2016

The topic described in this article is a part of my Specification Pattern in C# Pluralsight course. Specification pattern is not a new topic, there are many of its implementations on the Internet already. In this post, I’d like to discuss the use cases for the pattern and compare several common implementations to each other. 1. Specification pattern: what’s that? Specification pattern is a pattern that allows us to encapsulate some piece of domain knowledge into a single unit - specification - and reuse it in different parts of the code base.

01 Feb 2016

While such classes as Person and Money are pretty intuitive and can be easily attributed to either entities or value objects, the choice isn’t so obvious when it comes to classes that are internal to an aggregate. That is classes that aren’t roots of their own aggregates but rather parts of existing ones.



22 Jan 2016

My DDD in Practice course for Pluralsight went live. Why should you watch this course? I’ve been consistently applying DDD principles in my projects for about 6 years now and I can’t express enough how much value Domain-Driven Design has brought to me. The blue book written by Eric Evans was the most influential book I’ve ever read in my career. If you read this book too, you must have noticed that while it provides invaluable insights, it doesn’t tell much about how to implement them in practice.

18 Jan 2016

In this article, I’d like to share an example of how the KISS principle can go against the database normalization principles and how to make a choice in such situation. The example Some time ago, I had a task which required me to implement linkage between the users of an application and their social accounts. At the time, we planned to add only two social providers - Facebook and Google - but others could be potentially integrated as well in the future.

11 Jan 2016

The topic described in this article is a part of my Domain-Driven Design in Practice Pluralsight course. I wrote about entities and value objects some time ago. In this post, I’d like to talk about differences between Entity vs Value Object in more detail. I know, the topic isn’t new and there are a lot of articles on the Internet discussing it already. Nevertheless, I didn’t find any with an exhaustive, comprehensive description, so I decided to create my own.



22 Dec 2015

It’s a small post with an overview of the articles I wrote during this year.

14 Dec 2015

A couple of days ago, a nice analogy came to mind which I thought would be an interesting one to share: early exit is essentially a tail call optimization of procedural languages. Let’s see how it is so.

08 Dec 2015

Regions feature in C# is frowned upon by many. There are good reasons for that. In this post, I’d like to discuss why exactly you should avoid using them.



30 Nov 2015

Do you need an ORM for your project given you use a relational database? And not just some lightweight like Dapper but a big one: NHibernate, Entity Framework, Hibernate? I’d like to address this question with this post.

19 Nov 2015

In this post, I’d like to make a comparison of two approaches that prevail in the world of (mostly enterprise) software development: domain-centric and data-centric. If you read my last post (or any other post, quite frankly), you might have noticed I personally gravitate towards the domain-centric approach. Although this article is intended to be an impartial one, keep in mind that my bias can leak out. Domain-centric vs data-centric approaches The main difference between the two approaches is in the way people adhering to them treat software.

11 Nov 2015

<TL;DR> No, it isn’t. While SQL is a Turing-complete language and we can use it to encode any business logic we want, placing business (domain) logic into SQL leads to a less maintainable solution comparing to one that uses an OO or functional language. Because of that, I advocate to limit the use of SQL to read-only queries (which can potentially contain business logic, that’s fine) and simple CRUD statements where possible.

06 Nov 2015

The concept of NoSQL databases has been around for a while, but there still are quite a few misunderstandings regarding the topic of relational SQL vs NoSQL databases. In this post, I’d like to clarify the most common misconceptions and discuss the primary use cases for each of them.



19 Oct 2015

When you enter some field as a novice, there is a lot of stuff you must learn in order to become proficient in it. The learning path can usually be broken down into 4 stages of competence which you can traverse in 2 different ways.

12 Oct 2015

I’d like to wrap up the "Most valuable software development principles" article series with this post.

05 Oct 2015

Another software development principle I advocate you follow is making implicit assumptions explicit in your code. Let’s see what that means.



28 Sep 2015

You have probably heard of such phrase as “make illegal states unrepresentable” already. Basically, it stands for using some set of techniques for dealing with illegal states in your domain model. In this post, we’ll look at how C# and F# allow us to handle them.

22 Sep 2015

Today, we’ll look at Coded UI and White automation frameworks in terms of building an automated UI test suite for a WPF application. We are going to compare them from different points of view, such as performance, the ease of getting started and maintainability. You will see which of these two frameworks suits what kind of projects and how to make a decision in your particular circumstances.

21 Sep 2015

My first course for Pluralsight went live! In it, I talk about techniques and best practices for building a UI test suite for WPF applications. During the course, I go through such topics as: Why we should invest our time into UI tests in the first place. Different types of manual tests and which of them we can automate. The comparison of Coded UI from Microsoft and open source White from TestStack.

15 Sep 2015

The fail fast principle is underlying for many other software development practices. It comes out so often that it’s hard to cover all its appearances in a single article. Nevertheless, that is exactly what I’m going to do here :)

11 Sep 2015

Another principle we should follow when building a software project is the DRY principle. The abbreviation stands for Don’t Repeat Yourself. While it seems pretty straightforward and intuitive, this principle is more than meets the eye. Let’s see how it is so.

02 Sep 2015

This is another post on the most valuable principles in software development.

You might have heard of a guideline saying that we should aim to achieve low coupling and high cohesion when working on a code base. In this article, I’d like to discuss what this guideline actually means and take a look at some code samples illustrating it. I also want to draw a line between these two ideas and show the differences in them.



26 Aug 2015

The topic described in this article is a part of my Database Delivery Best Practices Pluralsight course In the previous two articles, we looked at the theory behind the notion of database versioning. Today, I want to dive into practice and discuss the database versioning tools available at our disposal. Database versioning tools classes The tools on the market can be divided into two classes: those which follow the state-based approach and those that adhere to the migration-based principles.

18 Aug 2015

The topic described in this article is a part of my Database Delivery Best Practices Pluralsight course In the previous post, I wrote about the database versioning best practices. I’ve got a lot of feedback on that topic. One of the responses stated that the article was (admittedly) one-sided as it didn’t cover the other widely spread approach to managing the database delivery process. I decided to fill that gap and provide my own comparison of the two.

10 Aug 2015

The topic described in this article is a part of my Database Delivery Best Practices Pluralsight course. Keeping track of your application’s database is not an easy task. Database schemas tend to mismatch in different environments, data in one of the databases may miss some crucial piece of data. Such occasions can be irritating, especially when caught in production. The situation gets worse when you develop redistributable software. In this case, each of your clients has their own database instance whose structure may differ from others'.

03 Aug 2015

Last week, we discussed the differences between stubs and mocks. Today, we’ll talk about some general tips and advice that regard to TDD and writing tests in general.



27 Jul 2015

In this article, I’d like to discuss the differences in using stubs and mocks and show how you can abandon using mocks even in the cases where you need to verify that objects interact with each other correctly.

20 Jul 2015

In the previous articles, we discussed what causes the pain while writing unit tests (mocks), and how to make TDD painless (get rid of the mocks). Today, I want to set the groundwork and discuss why mocks actually cause so much pain to us, developers.

13 Jul 2015

Unit testing is good at checking the correctness of your code in isolation, but it’s not a panacea. Only integration tests can give us confidence that the application we develop actually works as a whole. They are also a good substitute for mocks in the cases where you can’t test important business logic without involving external dependencies.

06 Jul 2015

Last week, we nailed the root cause of the problems, related to so-called test-induced damage - damage we have to bring into our design in order to make the code testable. Today, we’ll look at how we can mitigate that damage, or, in other words, do painless TDD.



29 Jun 2015

I’m going to write a couple of posts on the topic of TDD. Over the years, I’ve come to some conclusions of how to apply TDD practices and write tests in general that I hope you will find helpful. I’ll try to distil my experience with it to several points which I’ll illustrate with examples.

22 Jun 2015

The third most important software development principle is Encapsulation.

15 Jun 2015

Today, I’m going to discuss the KISS principle. I consider it the second most valuable software development principle.

11 Jun 2015

I’m starting a new blog post series about the most valuable principles in software development. Not that I think you might not know them, but I rather want to share my personal experience and thoughts on that topic. The order in which I put those principles reflects their significance relative to each other, as it appears to be in my opinion.

That is quite a large subject and I’m going to dilute it with articles on other topics, so it might take a while.

Okay, let’s start.

08 Jun 2015

Hard coding is often considered an anti-pattern. Having values that can change over time hard-coded in the source code requires recompilation every time these values actually change. While this statement is true, I think that hard coding should be the default choice when developing an application. Hard coding vs configuration file When you work on a project or feature, there always are some magic numbers or strings that potentially can change in future.

02 Jun 2015

Today, I’d like to discuss the differences between interfaces, abstractions and .NET interfaces, as well as what the term "implementation details" means.



18 May 2015

I guess most developers heard the guideline stating that, when designing methods, you should return the most specific type and accept the most generic one. Is it always applicable? Let’s try to look at it from different perspectives.

11 May 2015

I guess you already know about the safe navigation operator (?. operator) coming up in C# 6. While it’s a nice syntactic sugar for quite a few cases, I’d like to point out some misuses of it I’m sure we will see when C# 6 is released.

06 May 2015

We often think that relational and NoSQL databases are somewhat incompatible. But what if we could use both within a single domain model? I’d like to show how to combine SQL Server and MongoDB together and discuss what benefits we could get from it.



27 Apr 2015

Today, I’d like to discuss a particular case with validating input data using NHibernate event listeners.

20 Apr 2015

CQRS is a pretty defined concept. Often, people say that you either follow CQRS or not, meaning that it is some kind of a binary choice. In this article, I’d like to show that there is some wriggle room in this notion and how different types of CQRS can look like. Type 0: no CQRS With this type, you don’t have any CQRS whatsoever. That means you have a domain model and you use your domain classes for both serving commands and executing queries.

13 Apr 2015

In this article, I’d like to clarify the differences in DTO vs Value Object vs POCO where DTO stands for Data Transfer Object, and POCO is Plain Old CLR Object, also known as POJO in Java environment.

03 Apr 2015

Did you think about how we think? How do we come up with a solution and how we decide whether it’s good or bad? It seems like a very interesting topic, so let’s dive in!



27 Mar 2015

If you use Resharper, you must have been using some (or maybe most) of its features already. But what I see a lot is that some really useful features are left unattended. I want to describe those lesser known yet very useful features that can help you in your day-to-day work.

20 Mar 2015

The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. In this article, I’m going to write about how to deal with failures and invalid input in a functional way. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors Handling errors in C#: the common approach The concept of validation and error processing is well known, but the code required to handle it may become really annoying in languages like C#.

13 Mar 2015

The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. This is the third article in my Functional C# series. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors C# non-nullable reference types: state of affairs Look at the code example below:

07 Mar 2015

The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. This is the second article in my Functional C# blog post series. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors What is primitive obsession? Primitive obsession stands for using primitive types to model domain.

02 Mar 2015

The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. I’m starting a series of articles in which I want to show how to program in C# in a more functional way. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors Why immutability?



26 Feb 2015

The use of exceptions for flow control was raised quite a few times already (here’s a c2 discussion and here is a great question on SO). I’d like to summarize this topic and provide some common use cases along with code examples to handle them. Exceptions for flow control: why not? Generally, code is read more often than written. Most of the best practices aimed to simplify understanding and reasoning about the code: the simpler code, the fewer bugs it contains, and the easier it becomes to maintain the software.

14 Feb 2015

Input validation rules are often taken for code contracts. In this post, I’ll try to cover their differences and show what their common use cases are.

08 Feb 2015

Most of the development principles are applicable to any software you might develop. Nevertheless, there are some differences between building a reusable library and an enterprise application. Those differences often become sticking points as we try to apply experience gained in one type of project to projects of the other type.

The differences between shared library and enterprise development grow from differences in requirements and lifetime support cycle.

02 Feb 2015

Nowadays, notion of composition over inheritance is quite widely accepted. It basically means that when designing a software, you should prefer composition to inheritance, although you could use either one. But what if several classes do have some common attributes? Do you need to extract a base class for them? When inheritance is not an inheritance In OOP, inheritance stands for "is-a" relation. That is, a class A can be treated as a sub-class of a class B if A *is* a B in a way that makes sense for our particular domain.



30 Jan 2015

I often see developers saying that in most cases, use of IEnumerable breaks LSP. Does it? Let’s find out. This is the continuation of my article Read-Only Collections and LSP. It this post, I’d like to discuss IEnumerable interface from a Liskov Substitution Principle (LSP) perspective. Liskov Substitution Principle and IEnumerable interface To answer the question whether or not use of IEnumerable breaks LSP, we should step back and see what it means to break LSP.

17 Jan 2015

Did you think about what traits make developers great? Which one is the most valuable for the companies they are working for?

While there might be quite a few of them, I believe there’s one that employers value the most. I also believe getting that characteristic can drastically increase your value as a software developer.

10 Jan 2015

Microservices have got a lot of traction last year. It’s always interesting to read about success stories other people have; they tend to inspire you to try this new trend out in your own project.

However, there are several traps you can fall into if you follow this trend without deep understanding of its fundamentals. Today, I’ll share some bad practices I saw one particular company used on its way to adopt microservices architecture.

03 Jan 2015

I’ve already written about base entity class. Today, I’d like to continue with Value Object base class I use in my projects. Also, I’ll share some best practices regarding Value Objects implementation. Value Objects: what is it? An object that represents a descriptive aspect of the domain with no conceptual identity is called a Value Object. Value Objects are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.



27 Dec 2014

How often do you see code like this in your domain model? public void Ship(int orderId, int customerId, string address) { Shipment shipment = _existingShipments.Single(x => x.OrderId == orderId); if (shipment.CustomerId == customerId) { // Do something  } } Seems pretty good, doesn’t it? Well, it doesn’t. I’ve already pointed using Ids in domain entities as a bad practice, but I see developers - even sophisticated ones - write such code over and over again, so this topic definitely deserves a separate article.

20 Dec 2014

I’d like to discuss some common pitfalls of async/await feature in C# and provide you with workarounds for them.

13 Dec 2014

Microsoft has released async/await feature in .Net 4.5. It’s a really great stuff as it significantly simplifies one of the most painful areas - asynchronous programming. Before that, Task Parallel Library (TPL) and Parallel LINQ (PLINQ) were released in .Net 4.0. They address problems with parallel programming - another painful area in .Net.

I often see programmers struggling with a question when to use each of these features. Let’s step back and recall what does it actually mean to be asynchronous or parallel.

06 Dec 2014

Last week we compared Entity Framework and NHibernate from a DDD perspective. Today, I’d like to dive deeper into what Separation of Concerns (SoC) is and why it is so important. We’ll look at some code examples and features that break the boundaries between the domain and persistence logic. Separation of concerns in ORM There are several concerns we deal with in software development. In most applications, there are at least three of them clearly defined: UI, business logic and database.



22 Nov 2014

I often see programmers saying that .NET read-only collections violate Liskov Substitution Principle. Do they? The quick answer is no but let’s go through the whole story first.

15 Nov 2014

Mark Seemann brings up a very interesting subject in his post: how to fit Command Query Separation principle in case you have to save a brand-new object in a database and also need the created id back? Sure, you can have GUIDs for identifiers (which have some drawbacks as I’ll show later on), but what if you really need integers? I’ve been asked the same question for several times, so in this post I’ll share the solution I use for this problem.

08 Nov 2014

If you follow DDD principles, you eventually end up creating a base class for all the domain entities. It’s a good idea as it allows you to gather common logic in one place. When you decide to do that, you inevitably face the question of what exactly should be included in that base entity and how it should be presented.

01 Nov 2014

It’s the first post on the blog I’m starting today. The idea to start blogging was with me quite for a while, so I decided to give it a try.