Software developmentSoftware testingTDD

Test-driven discipline

I’m going to hold an internal one-hour TDD training course tomorrow at work, and I plan to use this article as a reference. The majority of my co-workers has already taken part in a pretty great software craftsmanship training held by Kevlin Henney, so they should all be absolutely convinced of TDD. But understanding the value of TDD is not the issue here, making it work is. Therefore, I won’t tell people how great TDD is and why they should do it a lot more. Instead, I’ll give advice on how to stick with a test-driven approach without dropping efficiency, and possibly even more important, without losing your mind. I’ll do this by outlining the issues I had when I dipped my toes in the TDD pond. And… Continue Reading…

Software development

Singletons are not your enemy

The singleton design pattern ensures that a class can be instantiated once only. It provides easy access by means of a global operation that returns this single instance. Definition of the singleton design pattern A large portion of the programming community has recognized the singleton design pattern as an antipattern that is best avoided. This recognition is strong enough that most developers won’t touch a singleton with a ten-foot pole, even if their lives depend on it. I have a problem with most extreme opinions, mainly because they are usually quite wrong. And this is one of those, a pseudo truth that is being repeated over and over again like a prayer without questioning. Some high deity in the form of a prominent developer once spoke it out… Continue Reading…

Software development

Advanced weapons of mass construction

The creation of objects is one of the most popular topics in software development. It’s that popular because there is a vast range of possibilities and almost every road leads to Rome. But different projects have different needs, and the same is true for organizations and target audiences. Whatever works well in one spot may be either too complex or too crude in another, and here is where things get tricky. Developers have to have a good understanding of the requirements and how the code will eventually be used. And that has to happen before the actual object creation mechanism is planned and implemented. In the world of dotnet, the most common way of creating an object is calling a constructor. This is as simple as it gets,… Continue Reading…

Software development

Jobs and workflows

I have recently changed my job and there’s a lot to wrap my head around now. My new employer is about 250 times larger than my previous one, and apparently, there comes a lot of change with that size. For starters, I am now officially called a software architect. I did successfully complete a software architecture program in 2018 with my old employer, where I was also certified as a software architect, but my designation didn’t change, and I kept being an ordinary software developer. To be fair, this never even bothered me, since my job didn’t change at all with the certificate. If you work on client projects in a mid-size software house, you’re doing the full stack of the job anyway, and every one of your… Continue Reading…

Software development

Making mistakes: Part 4

There can only ever be one common assembly, and it isn’t yours. This is my favourite, and it can be found in almost every bigger project. I’ve seen it with every single client without exception, and I’ve done it myself until a few years ago. Most of us know it as that dreadful assembly called Common, Core, Base, Internal or similar (I’ll use Common for the rest of this article). It’s also known as the dark spot in a project, that everybody is required to use and that nobody wants to touch. A place for coding horrors that just keeps on growing into a swamp of nightmares. Too graphical and exaggerated? It’s the place where developers like to put all the code that multiple components of a project… Continue Reading…

Software development

Making mistakes: Part 3

Never underestimate a coder’s pride. I did that a few years back, when I joined a project with a new customer. The team consisted of four developers on site, led by a senior software architect and a group manager. Three more developers were also hired from another country to help create highly encapsulated features. This was the first customer project where I was presented with continuous integration, gated check ins, automated tests and code analysis tools like SonarQube. The software architect – let’s call him Stephen – had put a lot of effort into this development process, and he had done a really great job with it. Naturally, I was very enthusiastic about the project and I immediately felt that this was going to be great fun. We… Continue Reading…

Software developmentVisual Studio

Making mistakes: Part 2

Delete all your binaries before a release build. An incredibly easy way to mess up your project is forgetting to delete all your own binaries before building and testing a release candidate. It’s so easy to miss that most companies run dedicated build and test systems that enforce a clean environment before any meaningful action is taken. Not all developers can enjoy that kind of safety at work, and even less of us at home. But first, let’s go ahead and dig a little deeper into how Visual Studio treats assembly references, and why this is so important. There are three kinds of assembly references that I am aware of and each one has its specific behaviour. There is the project reference that we get a lot in… Continue Reading…

Software developmentWPF

Value conversion in WPF

WPF is the top-notch UI technology from Microsoft, that finally enables us to properly separate business logic and UI from each other. There is plenty of material and documentation about it on the internet, so I won’t bother giving a general overview in this article. If you know WPF, then you already know what it is. You may have noticed that the initial learning curve of WPF is crazy steep, since it’s such a huge and powerful framework. Especially the part where backend and frontend are separated cleanly is very hard to get right in the beginning. The concept behind this is called MVVM, where the goal is to design the entire UI in XAML, using as little code-behind as possible. One of the techniques that WPF offers… Continue Reading…

Software development

Weapons of mass construction

There is a follow-up post: Advanced weapons of mass construction Last time I wrote about how to use interfaces to their full potential, but I never really mentioned factories beyond the fact, that we probably need them. This is going to be another chapter to the previous post with a more in-depth look into the matter of encapsulated object creation in C#. Again I will start with what I usually find in a client’s project, and then I will move in small steps towards a progressively more mature implementation. Every step will include a bit of code to demonstrate the changes that were made. Making up a good example to demonstrate factories is surprisingly hard. There is a multitude of possible scenarios available, but most are too complex… Continue Reading…

Software development

Interfacing in style

I tend to give the same talks to clients whenever I enter another project, mostly to get everybody up to speed when there are deficits. In writing everything down, I hope to make the knowledge transfer a little easier, so that I can refer to this and other similar articles in the future. Interfaces are a very useful and important construct in C#, and I believe that any developer worth their salt is going to agree. But they can also be one of the biggest flaws behind an error-prone architecture or a hard to maintain code base. I will start by describing the two basic kinds of interfaces and then describe the typical situation in the code base of most clients. The focus will be on how to… Continue Reading…