Learnings from working 6 years as a Software Engineer

Gustav Sundin
By now I have studied software engineering at university for 6 years and then worked professionally within the field for another 6 years. During this time I have picked up a few patterns, methodologies and assorted tips & tricks that I would like to share with everyone. Hopefully you’ll learn something, and please let me know if you disagree with anything. There are always different aspects of every topics and I would love to hear your thoughts about it!

End-to-end testing field guide

Gustav Sundin
This is a beginner’s guide to getting started with end-to-end (E2E) testing. It is intended to be read as a high level overview of best practices, as there are already plenty of great and detailed tutorials on various frameworks “out there” on the Internet. This guide uses Cypress as the example testing framework (just because it’s the one I use the most), but the same methodology as described here can be applied using any framework.

Building a custom dialog in Flutter

Flutter’s built in Dialog widgets (also known as popup or modal) such as the AlertDialog are pretty nice, but sometimes you want to build something custom to fit in with your app’s look and feel. In this blog post I will show you how! What we will build Here’s how my custom dialog looks like (screenshot taken from my RPG app Sound Realms: Mace & Magic). You can see that it differs quite a bit from the standard dialog.

Introducing Sound Realms: Mace & Magic

Sound Realms: Mace & Magic is an audio-based solo RPG adventure app for iOS and Android devices. I have been programming on it for around 8 hours per week since October 2020, so by now it is starting to shape up real good! Download the free demo adventure to your phone if you are intrigued. The idea is to craft an inspiring and captivating experience that lets you use your imagination.

Practice disaster scenarios

Gustav Sundin
Practice disaster scenarios, at the very least as thought experiments. Some ideas to get you started: What happens if your Kubernetes cluster gets funked up? What do we do? Create a new one from scratch? Do we know how to do that? What happens if our production database gets corrupted? Do we have backups? And do we know how to restore one? Make sure to write down clear instructions beforehand so that some sleep-deprived on-call developers don’t cause even more harm by panicking when we have a real incident.

Robust end-to-end testing with Docker Compose

Gustav Sundin
End-to-end (E2E) testing is a powerful tool for automated quality assurance. Ideally you want to be able to catch potential errors and bugs already on the unit testing level, but doing so can sometimes be both time-consuming and difficult. Unit testing also relies heavily on mocking out dependencies by nature, so we cannot necessarily guarantee the same behaviour as in our live application. E2E tests are on the other hand often very straightforward to set up and write, and enables us to construct very realistic testing scenarios.

How to use HTTPS on localhost

Gustav Sundin
Sometimes you want to have your application running on HTTPS even when testing it out locally. One common approach is to use a self-signed certificate, but this method has some pitfalls - most notably that any browser will frown upon your certificate and start shouting that it is insecure. A more robust approach is to use a certificate generated by a Certificate Authority (CA). How? Enter mkcert, which lets you act as your own CA.

Token-based authorization in .NET Core 6.0

Gustav Sundin
This blog post describes how to implement token-based authentication and authorization using .NET Core 6.0. The way this works is that when the user is authenticated, a token containing various claims will be stored in the user’s browser. This cookie will be used in subsequent requests, and the claims can be checked on different endpoints in order to provide authorization. Now let’s get coding! Inside Startup.cs, add the following to the ConfigureServices(IServiceCollection services) method:

Introducing Frontman

Gustav Sundin
Frontman is a very light-weight NGINX reverse proxy that is deployed using Docker. Its purpose is to act as the entry point to your server. It will redirect incoming traffic to one out of many Docker-based applications running on the same server, based on the hostname in the incoming request. The rationale behind this is that it enables you to host as many services as you want on the same server, while still only keeping ports 80 and 443 open to the outside world.