Kuba's space

Home

Abstract current time using function in C#

Apr 9, 20212 min read

I've seen many ways to deal with date and time. Hiding it behind an interface, a static class with a single property, ambient context, you name it. I never liked any of them. Then the enlightenment came. In one of the projects, I've seen a function u...

Table driven development

Mar 30, 20212 min read

How do you start a new project? From my experience, most of the projects begin with a search for a verb. Not any verbs. The important ones! The question arises, how do you spot the important one? That depends on the domain, of course. As an example,...

Improve class coherency with local functions

Mar 9, 20212 min read

I was full of doubt about local functions at first. They break some dogmas for me. For example, return from the method isn't the last statement anymore. Then I started to use them. Now I can say that this idea makes code more readable and keep classe...

Using collections with MemberData attribute in F#

Feb 21, 20212 min read

Working with collections of custom types in xUnit always felt clumsy. To pass such a set of data, you had either create a property or a whole class. No matter which options you choose, it's a lot of boilerplate. What a pleasant surprise was how less ...

Using tuples for validations

Feb 9, 20212 min read

Many functional techniques are proving their ground in C# codebases. One of my favorites is the Result type. The most basic form consists of a boolean flag indicating success and an array of errors. But in many cases, tuples are just enough. I fall ...

Creating tasks in batches

Jan 26, 20213 min read

Recently I've learned that you have no control over tasks after initialization. Awaiting a job is just a way to synchronize and get a response. That naturally brings a question. How to split asynchronous calls into batches? A case from the trenches L...

© 2021 Kuba's space

PrivacyTerms
Proudly part of