Skip to content

Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Follow @CodeOpinion

Uncategorized

Static Variables & Methods are Evil?

You might have heard the recommendation to steer clear of static variables or methods. But is that really good advice? Let’s dive into why people say that, with a little nuance, and clarify the topic with some examples. YouTube Check out my YouTube channel, where I post all kinds of content accompanying my posts, including this video showing everything in this post. Deterministic Behavior First off, let’s talk about determinism. I have a method called is18YearsOrOlder, which takes a DateTime argument representing your birth date. The method checks if you’re 18 years or older by adding 18 years to your birth date… Read More »Static Variables & Methods are Evil?

I’d rather read 50 lines than Extract Method Refactoring

Extract Method refactoring is a great way to give names to concepts so code is easier to read and flows. But it can go wrong when you use it, creating a lot of indirection and unexpected behavior from the methods you extract. YouTube Check out my YouTube channel, where I post all kinds of content accompanying my posts, including this video showing everything in this post. I want to dive into a topic that’s been on my mind: refactoring, specifically the “Extract Method” technique. TLDR: I’d rather read a longer method—maybe around 50 lines—than get tangled up in a web of indirection… Read More »I’d rather read 50 lines than Extract Method Refactoring

Persistence Ignorance is Overrated

If you’re using an ORM and creating “domain entities” you’re likely trying to force your database structure into your domain model. That can work but the point of persistence ignorance is to let you domain model shine without knowing how it’s persisted. But you’re data structure will force you down a certain path if you treat your data model as your domain model. YouTube Check out my YouTube channel, where I post all kinds of content accompanying my posts, including this video showing everything in this post. Persistence Ignorance Persistence ignorance is a great concept, but in practice, it’s a little harder… Read More »Persistence Ignorance is Overrated