If you have been programming for any length of time, you may well have come across higher order functions, but (like me) may not have fully appreciated just how powerful they can be. If you’ve not heard of them before, never fear, I have an explanation below.

What are higher order functions?

Simply put, a higher order function is a function whose input or output is also a function.

In the following example, the Map function takes a list of a particular data type and a function, and returns a new list with the function applied to each of the elements in the list (basically…


It’s been over a month now since I last wrote an article here for my blog. I’ve been struggling a lot with low mood, which has meant that I haven’t had the motivation or the energy to produce new content. I have been getting help, which I’ve found really useful, so I thought I’d share some of the things I’ve learned in the hope that it might help other developers in a similar position.

Stop comparing yourself to others

If you spend any amount of time online in tech communities, such as on Twitter, you’re probably used to seeing people who seem to spend all…


If you’ve spent time around C# and .NET, it’s likely that you will have come across LINQ (Language-Integrated Query), which allows you to use a range of powerful querying capabilities directly in the C# language.

The example below demonstrates a couple of common features of LINQ (note that I am using the extension method syntax rather than LINQ expressions). In the example, we have a list of people and want to obtain a list of names of the adults in that list. …


Dependency injection (DI) is a wonderful thing. Simply add your dependency as a parameter to the constructor (most commonly) of your class, register it with your DI container, and away you go — the DI container will manage the rest. Some of the key benefits of DI are: greater testability, greater maintainability, and greater reusability.

// without DI
public class OrderController : Controller
{
public ActionResult Post(Order order)
{
using (var dbContent = new MyDbContext())
{
dbContext.Orders.Add(order);
dbContent.SaveChanges();
return Ok();
}
}
public ActionResult Get()
{
using (var dbContext = new MyDbContext())
{
var orders = dbContext.Orders.ToList();


What is Primitive Obsession?

To start with, primitives are the basic data types available in most languages. These include data types such as strings, numbers (int, floats), and booleans.

Primitive obsession is a code smell in which primitive data types are used excessively to represent your data models. The problem with primitives is that they are very general. For example, a string could represent a name, an address, or even an ID. Why is this a problem?

  • They can’t contain any model-specific logic or behaviour, meaning that any logic must be stored in the containing class. …


Recently I’ve been learning how to write code in F#. For those who haven’t heard of it, F# is Microsoft’s/.NET’s answer to a functional-first programming language. My motivation was to learn a functional programming language that would make coding for scientific computing and data analysis more expressive, concise, and maintainable, all while fitting seamlessly into the .NET ecosystem that I already know and love. F# fits that bill perfectly.

Why Functional Programming?

For an object oriented programmer, the idea of functional programming can be a little foreign at first. We’re used to applications in which everything is an object and the application works…


Vue Draggable is a great library for Vue.js that makes it super simple to create interactive draggable components with virtually no effort. I have recently used it to create an interactive kanban board, in which tasks can be rearranged and moved between cards just by dragging.

So let’s start by creating some reorderable cards! P.S I’m using Vuetify as the UI framework, in case the tags look unfamiliar.

<template>
<v-container fluid>
<v-row>
<v-col class="text-right">
<v-btn color="primary" depressed @click="addCard"> Add Card </v-btn>
</v-col>
</v-row>
<v-row>
<v-col v-for="(card, i) in cards" :key="i" cols="12" sm="6" md="4">
<v-card outlined>
<v-card-title>
<v-text-field v-model="card.title"></v-text-field> …

I’m not ashamed to admit that for a long time I avoided writing tests for my code. I saw it as something that took up precious time that I could have spent on “real” coding. However, after experiencing first-hand the headache caused from having to maintain production code with little-to-no tests, I’ve been convinced that writing tests really are worth your time. Too many times have I been bitten by hidden bugs, that could have easily been identified if the appropriate tests were in place.

Test Driven Development

Test Driven Development (TDD) is a software development cycle that focusses on describing the behaviour…


I recently wrote a blog post introducing some of my favourite NuGet packages: My Top 4 NuGet Packages for ASP.NET Core. In that post, I briefly introduced a package called MediatR. Today, I will dedicate this post to revisiting MediatR in further detail.

What is MediatR?

MediatR is an implementation of the mediator pattern. It is a behavioural software design pattern that helps you to build simpler code by making all components communicate via a “mediator” object, instead of directly with each other. This helps the code to remain highly decoupled and reduces the number of complex dependencies between objects.

A good real-world…


In this article, I will teach you the basics of making your own web app, by creating a checklist app. ASP NET Core will be used to create a CRUD API and Vue will be used to create the frontend UI. Using the knowledge gained here, you should be able to apply it to start making your own web apps. You can find the complete solution in the GitHub repository.

We will first start with building the API and then move on to the Vue client.

Creating a checklist API

Start by creating a new ASP NET Core Web API project in Visual Studio.

Sam Walpole

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