MSc. | Writer with +1M views. | Lead Developer and Manager in Big4, ex. FinTech. Sharing my opinion & what I learn. New YouTube Channel

Opinionated Perspective

Why “write code juniors understand” is terrible advice

Image by Nicklas Millard

“Don’t use that construct (syntax, approach, pattern, or whatever), juniors won’t understand it!”

This makes perfect sense from a management point of view since we can get away with hiring less experienced people.

Continuously dumbing down code only makes sure your junior developers stay dumb.

Dumbing down your code to…

Examples in C# .NET 6

How to write proper repository classes that won’t give you headaches.

Image by Nicklas Millard

The repository pattern is possibly one of the very first widely practical design patterns you learn or apply in a real production application. It’s definitely a pattern worth double-clicking on and internalizing as it has almost become a first-class citizen of any data access layer.

The repository design pattern is…

Practical Programming Advice

Are they just different ways of solving the same problem?

Image by Nicklas Millard

You’ve likely watched lots of tutorials on inheritance and composition, and my guess is you’re still slightly puzzled by their utility or when to pick one over the other.

For our example, we’ll work with a schedule model with a few variations, such as triggering daily or weekly. Also, we’d…

Practical Programming Example

You’ll rarely ever need to branch on a discrete value.

Image by Nicklas Millard

I’ve mentioned this a tonne already, and this won’t be my last, but branching on discrete values using switch cases and if-else statements is often a terrible idea.

Each if, each else, and each case adds needles cognitive and cyclomatic complexity to your codebase.

Opinionated perspective

Experienced developers are guilty of bad designs as well.

Photo by Sakura on Unsplash

You’ve likely watched countless tutorials and read software design books all telling you how interface-based, explicit dependencies allow you to create loosely coupled classes.

“New is glue,” right? The dogma is to let your classes take explicit dependencies as a constructor or method parameter rather than newing up an object…

Practical Engineering Guide

Best practices for creating pull requests and doing code reviews.

Image by Nicklas Millard

Changelist, patch, pull request, no matter the name only a few things can get as toxic as the process of merging your hard work into the shared codebase.

Some regard code reviews as an invitation to assert their knowledge, voice their unfounded opinions, publicly shame others, telling others how to…

Opinionated Perspective (Short-form)

It’s not your lack of coding skills or critical thinking. It’s your approach.

Image by Nicklas Millard

Do you find software development difficult? Well, you’re not alone.

You can blame the language, the contradictory principles, and methodologies. Blame the ever-changing technological landscape. Maybe it’s the business that doesn’t know what it wants. Maybe you find it too difficult to settle on a tech stack. …

Opinionated Perspective (Short-form)

Clean domain models are persistence agnostic.

Poorly modeled domain class
Poorly modeled domain class

I assume most developers interact with their database thru object-relational mapping (ORM) technology. You rarely write raw SQL as an application developer these days.

This brings along a whole new set of issues.

Mixing concerns often lead to bad things in software development. I've found that marrying your domain model…

Opinionated perspective

Don’t write code just to make your ORM happy.

Image by @nmillard

Stop letting your database be in the driver’s seat of your application.

You probably let your database generate your ids. Don’t you? Maybe due to the convenience of it — there’s really nothing convenient about it, though.

How often do you make “pragmatic” decisions about your model? Or slack on…

Practical programming advice

Having more classes does not equal higher complexity.

Image by Nicklas Millard

So, there is a good chance that you’ve used parametric polymorphism already — it’s basically just generics. But, do you know how generics can help you reduce the use of branching statements, such as if-else and other control-flow statements?

if-else is often a poor choice, especially if you want to…

Nicklas Millard

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