F# Journey: Course 3 – Discriminated Unions

It has been a long time since my last post here. One of my colleagues told me that the receptiveness of the human brain shrinks after reaching the 27 year. So it’s about time to learn F# before it’s too late! In this post I want to present an calculator example with discriminated unions. I… Read More »

My 2 Cents on Singleton

The implementation of the singleton pattern is pretty easy. However, despite the simplicity I see often that the pattern is being misused or implemented wrongly. What I’ve seen so far: The implementation is not thread-safe. (coding issue) Tight coupling: The business code/logic accesses a static property of a class in order to utilize the singleton… Read More »

IQueryable vs IEnumerable vs IHaveHeadache

Yes.. this ist just another blog post about IEnumerable and IQueryable. But the topic is quite important and I think it worth discussing about both approaches. Recently I had a discussion with a software architect about the implementation of the repository pattern. The question was: Should the repository return IEnumerable or IQueryable? So let’s do… Read More »

WCF Configuration for Large Data

In one of our projects we had to transfer large data from the server to the client WPF application. In the beginning we had some performance issues. Therefore we decided to do some comparisons between ASP.NET Web API, WCF (with and without protobuf-net). The configuration: ASP.NET Web API WCF (Protobuf) WCF – Protobuf serializer –… Read More »

C# Code Snippet for Unit Tests

After coding unit tests the whole day, I decided to create a nice Visual Studio snippet which helps me to write the test method quicker. I usually structure my unit tests like this: public void Validate_ReturnsFalse_WhenStringIsTooLong() { // Arrange var expectedResult = false; var watheverMock = new Mock<IWathever>(); // Act var validator = new Validator(watheverMock.Object);… Read More »

Entity Framework and Expression Queries

In my current project I had to generate a Entity Framework query based on some search criterias defined in a dictionary. The structure of the dictionary was similar to this example here: var searchCriteria = new Dictionary<string, List<string>>() { { "FirstName", new List<string> { "Darko", "NoName" } }, { "LastName", new List<string> { "Micic", "Müller",… Read More »

F# Journey: Course 3 – Functions

Back to: F# Journey: Course 2- Type Inference The concept of a function exists is in F# too. However, it’s slightly different than in C#. A F# function has a name, list of parameters and a return value. The function itself is assigned to a value with the “let” keyword. The parameter types are inferred… Read More »

F# Journey: Course 2 – Type Inference

Back to: F# Journey: Course 1 – Immutable Values You probably know type inference already from C#. But in F# it’s like magic! You don’t have to define the type quite often. The compiler will automatically find out. Let’s start with some examples: let a = 1 // or let plus a b = a… Read More »

My F# Journey

After working 4-5 years mainly with object-oriented programming languages like C#, I thought it’s a good time to dive into other programming paradigms. For example: Functional programming -> F#! Based on the “Indeed Trends” (see at the bottom of this post) we see that the market is still not seeking a lot F# or Scala… Read More »