Sign in

Lead Software Engineer @ Write about Software Engineering Best Practices, Design Patterns, Refactoring, C# and .NET Core.

Steps to be more confident when changing the source code.

It is pretty easy to fix one bug and break the large application in ten different places. Everyone understands that it is impossible to avoid such cases due to the high complexity of the software. However, you can minimize the chance of regression issues by using steps which I usually follow in my day-to-day development activities.

Before Fixing The Bug

In my opinion, the more time the software developer devotes to “Before” stage, the more experienced he or she is. Usually, junior developers start coding right after reading the bug description, when senior guys follow these steps:

Outgoing Dependencies Analysis

Almost all objects, except for simple or…


With the pros and cons of each

The maturity of a software engineer is determined by many factors such as knowledge of algorithms, analytical thinking, big-picture focus, debugging skills etc. In addition, the following two factors are important from my point of view:

  • A software engineer knows several approaches to solve the same problem.
  • A software engineer chooses an approach based on an analysis of its pros and cons.

To help you get a little more mature, I’ve put together 5 ways to clone an object in C# and have prepared the pros and cons of each.

We are going…


Slow code is optional.

Software development is about finding trade-offs:

  • CAP theorem — developers need to choose just 2 out of 3 guarantees for software systems.
  • Normalization vs denormalization of relational database schemas — developers find a balance between ease of data update and data retrieval time.
  • Development speed vs high-quality coding — developers strive for high quality, which is a time-consuming exercise, while the business needs to have features ready as soon as possible.

High-performance C# code isn’t free either. Developers can sacrifice the maintainability or security of the code to make the code run faster. …


Learn in practice.

Working on real commercial projects helps software developers become professionals by acquiring practical knowledge. Developers, in addition to reading many books about, say, design patterns, need to understand how these patterns can be used to solve various problems in the real world.

Even the largest projects that developers work on often do not implement all existing approaches, patterns, and software engineering techniques. To learn as much as possible, a developer needs to work on multiple projects at the same time or change projects quite often. …


Builder, Fluent Builder, Strict Builder, Nested Builder.

Programming is so complex that there are always several ways to accomplish the same thing.

The Builder design pattern is no exception. I’m going to present you with 4 ways to implement the Builder pattern in C# while deliberately avoiding the classic implementation (according to my observations, this is practically not used).

Even though some implementations below may seem complex to use in production, they are a good exercise to train your OO and coding skills.

1. Just Builder

The builder is a class that provides a set of user-friendly APIs that clients can use to create an object.

The builder should hide…


Exploring C# static classes and methods from a design perspective.

Static classes and methods are one of the controversial programming tools.

  • Are static classes and methods bad design and coding practice?
  • Does using static classes complicate unit testing?
  • When are static methods the only viable option?
  • When should a class be static, and when should it be non-static?

We will work through this and other questions.

Static Classes and State Mutation

With static classes, it becomes very easy to couple multiple parts of your application.

There is nothing wrong when static class that is used by different part of the application does not have a state and always return deterministic results.

Here is the example…


Get hands-on with GitHub repositories.

Sample projects published on GitHub repositories have become an excellent source of knowledge for software developers, as well as books, online courses, and expert blogs.

Code analysis of sample projects allows developers to consolidate the theoretical knowledge they have gained from reading a book or article and see how certain development concepts can be applied in practice.

Good sample projects don’t have to be too complex, or developers will quit learning them halfway.

On the other hand, sample projects don’t have to be simple enough in order to be useful.

I have put together 5 great repos that I think…


By writing unit tests.

Today I would like to take a quick tour of the charming NetArchTest library that I started using a couple of months ago in my project to enforce various architectural application-specific rules and conventions by writing unit tests.

The NetArchTest library allows you to write unit tests that enforce architectural and design rules in your application. You can test your application for immutability, encapsulation, type dependencies, naming conventions, project layering, and more.

Let’s move on to a quick demo.

Here is a solution structure containing two simple .NET Core projects: Domain and ArchitecturalTests.


Practices for improving the design of software applications.

Object-oriented programming and design is not something that can be learned quickly. This is art. This topic requires software developers to read fundamental books, practice regularly, solve real-world problems, learn from more experienced teammates, and do other things.

This 5 minute post will not make you an OOP and OOP guru. However, this post has collected the most common examples of ineffective design choices and their better alternatives that you can use to fill knowledge gaps and maybe become a slightly better software developer in object-oriented programming and design than you are now.

1. Using Return Values for Input Validation Instead of Throwing Exceptions

Exceptions can be used to notify the…


When creating an object, think like an architect.

There are almost always several ways to achieve the same result in the programming world. Software developers can grow fast in a career if they regularly do a trade-off analysis of available approaches to solving design or coding problems before start writing any code.

What could be easier than creating an object? Almost nothing.

However, even this trivial task that developers do every day has 5 different approaches to it. Knowing the pros and cons of each way to create an object will allow developers to choose the most appropriate one for their particular case.

1. Create Object with new() Keyword

Pros:

  • This is the easiest…

Sasha Mathews

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