Milan Jovanović Profile Banner
Milan Jovanović Profile
Milan Jovanović

@mjovanovictech

34,169
Followers
655
Following
1,432
Media
11,205
Statuses

Practical .NET and Software Architecture Tips | Microsoft MVP 📰 The .NET Weekly: ▶️ YouTube:

Join 51K+readers →
Joined June 2022
Don't wanna be here? Send us removal request.
Pinned Tweet
@mjovanovictech
Milan Jovanović
3 months
The day has finally come. ​Modular Monolith Architecture is now open for enrollment. 🎉 I can't wait for you to see everything I have prepared! - 10 in-depth chapters - 60+ high-quality lessons - 14+ hours of video training content The course is organized into ten in-depth
Tweet media one
Tweet media two
Tweet media three
Tweet media four
16
32
173
@mjovanovictech
Milan Jovanović
1 month
𝗦𝗵𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝘀𝘁𝗼𝗽 𝘂𝘀𝗶𝗻𝗴 𝗨𝗨𝗜𝗗𝘀? UUIDs (Guid in C#) are widely used as unique identifiers in databases. UUIDs are random, which makes them popular in distributed systems. However, UUIDs have some drawbacks: 1. UUIDs slow down database inserts. Each
Tweet media one
71
418
3K
@mjovanovictech
Milan Jovanović
11 months
Do you want to learn Clean Architecture and DDD? I prepared 45 lessons for you 🔥 𝗖𝗹𝗲𝗮𝗻 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 𝗙𝘂𝗻𝗱𝗮𝗺𝗲𝗻𝘁𝗮𝗹𝘀 - Project setup - - Minimal APIs - - Dependency injection - -
Tweet media one
27
330
1K
@mjovanovictech
Milan Jovanović
1 month
I've been using Clean Architecture for 5+ years. Here's why I think it's amazing. 👇 The biggest pain point with enterprise applications is a lack of structure. Every project uses a different approach, making it difficult to transfer technical knowledge from one system to
Tweet media one
16
177
881
@mjovanovictech
Milan Jovanović
1 year
I worked on a system that has 10 API instances running in parallel and handles millions of requests per day. And I wondered for the longest time what makes an API horizontally scalable. I want to share my thoughts on this since I had a chance to work on a system like that.
Tweet media one
21
173
838
@mjovanovictech
Milan Jovanović
9 months
Do you want to learn Clean Architecture and DDD? I have prepared 45 lessons for you 🔥 𝗖𝗹𝗲𝗮𝗻 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 𝗙𝘂𝗻𝗱𝗮𝗺𝗲𝗻𝘁𝗮𝗹𝘀 - Project setup - - Minimal APIs - - Dependency injection -
Tweet media one
15
177
760
@mjovanovictech
Milan Jovanović
1 year
Here are 12 excellent libraries I use in my projects: 1. MediatR 2. FluentValidation 3. Serilog 4. Refit 5. Polly 6. Entity Framework Core 7. MassTransit 8. Quartz 9. SignalR 10. YARP 11. xUnit 12. FluentAssertions What would you add to the list?
88
111
753
@mjovanovictech
Milan Jovanović
10 months
𝗧𝗵𝗲 𝗗𝗼𝗺𝗮𝗶𝗻 𝗹𝗮𝘆𝗲𝗿 𝗳𝗼𝗹𝗱𝗲𝗿 𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲 𝘀𝗵𝗼𝘂𝗹𝗱 𝗲𝘅𝗽𝗿𝗲𝘀𝘀 𝗶𝗻𝘁𝗲𝗻𝘁. I didn't understand this a few years ago. The Domain sits at the core of Clean Architecture. It's where you define your entities and the most important business logic. So,
Tweet media one
Tweet media two
Tweet media three
17
149
738
@mjovanovictech
Milan Jovanović
9 months
CQRS = Separate read/write databases? Not so fast! This isn't really what CQRS is about. First, there was the CQS - Command-Query Separation principle. Here's what CQS is: - Commands change state, don't return data - Queries don't change state, return data - Queries should
Tweet media one
11
161
732
@mjovanovictech
Milan Jovanović
1 month
𝗦𝗰𝗮𝗹𝗶𝗻𝗴 𝗪𝗲𝗯 𝗮𝗽𝗽𝘀 𝘁𝗼 𝟭,𝟬𝟬𝟬,𝟬𝟬𝟬 𝘂𝘀𝗲𝗿𝘀 I worked on a large system that had more than a million users. This is how we scaled the system to handle that amount of traffic. The application started as a humble monolith: one application server and one
Tweet media one
3
122
722
@mjovanovictech
Milan Jovanović
1 year
Have you ever taken a leap of faith and pursued your passion? That's exactly what I did when I quit my job 43 days ago. Today is my first day as a solopreneur. Let me share how I got here and my plan for the future.
Tweet media one
59
35
679
@mjovanovictech
Milan Jovanović
8 months
Did you hear about screaming architecture? Your architecture should communicate what problems it solves. Moreover, it should focus on the use cases. Here's an example from Uncle Bob. When you look at the folder structure and source files, do they scream: - Health Care System
Tweet media one
25
134
676
@mjovanovictech
Milan Jovanović
1 year
I opened my inbox last night, half asleep after a long day, and I saw: I just became a 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗠𝗩𝗣 for Developer Technologies. I thought I was dreaming. What a way to start my first day as a solopreneur! #mvpbuzz #dotnet
Tweet media one
75
12
677
@mjovanovictech
Milan Jovanović
1 month
𝗨𝗻𝗶𝘁 𝘁𝗲𝘀𝘁𝗶𝗻𝗴 𝘃𝘀 𝗜𝗻𝘁𝗲𝗴𝗿𝗮𝘁𝗶𝗼𝗻 𝘁𝗲𝘀𝘁𝗶𝗻𝗴 I've learned that both unit and integration tests are important for ensuring the quality and stability of my code. However, the appropriate balance between the two types of tests will depend on your project's
Tweet media one
10
134
674
@mjovanovictech
Milan Jovanović
2 years
I helped a team reduce their Azure Application Insights cost from $10,000/mo down to $1,500/mo. I spent a good week researching potential issues. The end solution was kind of funny. Someone forgot to turn off Azure SQL logs. We flipped a switch, and the cost went down 85%.
29
58
659
@mjovanovictech
Milan Jovanović
8 months
Dependency Inversion + DDD = Domain-centric architecture A few famous examples are: - Hexagonal (ports and adapters) - Onion architecture - Clean architecture Clean architecture places the business logic and domain model at the application center. Use cases are also
Tweet media one
9
145
652
@mjovanovictech
Milan Jovanović
1 year
What are the SOLID principles? 🤔 As a .NET developer, I'm always looking for ways to improve the quality and maintainability of my code. I want to share my experiences using the SOLID principles and how they've helped me create better code.
Tweet media one
11
149
639
@mjovanovictech
Milan Jovanović
1 year
Here are 9 excellent libraries I use in my projects: 1. MediatR 2. Mapster 3. FluentValidation 4. Refit 5. Carter 6. MassTransit 7. Marten 8. xUnit 9. FluentAssertions
32
94
649
@mjovanovictech
Milan Jovanović
8 months
𝗪𝗵𝗮𝘁 𝗶𝘀 𝗴𝗥𝗣𝗖 𝗮𝗻𝗱 𝘄𝗵𝗲𝗻 𝘀𝗵𝗼𝘂𝗹𝗱 𝘆𝗼𝘂 𝘂𝘀𝗲 𝗶𝘁? gRPC is a high-performance remote procedure call framework developed by Google. Its primary use case is service-to-service communication. That's why you will often see it used with microservices.
Tweet media one
13
139
617
@mjovanovictech
Milan Jovanović
2 months
I spent 17 hours optimizing an API endpoint to make it 15x faster. Here's a breakdown of what I did. I worked on an e-commerce application. One endpoint was crunching some heavy numbers. And it wasn't scaling well. The endpoint calculated a report. It needed data from
Tweet media one
7
114
619
@mjovanovictech
Milan Jovanović
1 month
Here are 9 excellent libraries I use in my projects: 1. MediatR 2. Polly 3. EF Core 4. Refit 5. Testcontainers 6. MassTransit 7. Marten 8. xUnit 9. Dapper Which library would you add to the list? --- Subscribe to my weekly newsletter to accelerate your .NET
Tweet media one
29
107
602
@mjovanovictech
Milan Jovanović
10 months
Here are 13 excellent libraries I use in my Microservices: 1. EF Core 2. Dapper 3. MediatR 4. Refit 5. Polly 6. Scrutor 7. MassTransit 8. FluentValidation 9. Hangfire 10. Testcontainers 11. FluentAssertions 12. NetArchTest.Rules 13. StackExchange.Redis
23
91
592
@mjovanovictech
Milan Jovanović
1 year
8 tips for writing clean code: - Early return principle - Merge if statements - Use LINQ for conciseness - Bool expression -> Method - Prefer custom exceptions - Magic number -> Constant - Magic string -> Enum - Use result objects
Tweet media one
23
98
581
@mjovanovictech
Milan Jovanović
8 months
𝗨𝗻𝗶𝘁 𝗧𝗲𝘀𝘁𝘀 𝘃𝘀. 𝗜𝗻𝘁𝗲𝗴𝗿𝗮𝘁𝗶𝗼𝗻 𝗧𝗲𝘀𝘁𝘀 They're crucial for ensuring the quality and stability of my code. But, the balance between the two will depend on the project's needs. Unit tests are there to test individual units of code in isolation. They are fast
Tweet media one
10
124
579
@mjovanovictech
Milan Jovanović
8 months
I worked on a system handling millions of requests per day. It was a monolith application scaled out to 10+ API instances. Everything was running with one large SQL Server database. Working on this system redefined what it means to be "scalable". So, I want to share my
Tweet media one
11
127
572
@mjovanovictech
Milan Jovanović
1 year
Did you have a chance to work with the Outbox pattern? If you're working with microservices, this is definitely something to add to your toolkit. So what is it? The Outbox pattern is a technique for reliably publishing events in a distributed system.
Tweet media one
35
97
545
@mjovanovictech
Milan Jovanović
1 year
Most people think Redis is just used for caching. But it can do so much more! Here are a few use cases for Redis:
14
127
540
@mjovanovictech
Milan Jovanović
27 days
𝗣𝗮𝘁𝘁𝗲𝗿𝗻𝘀 𝗼𝗳 𝗘𝘃𝗲𝗻𝘁-𝗗𝗿𝗶𝘃𝗲𝗻 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 An event-driven architecture uses events to communicate between decoupled components. EDA is common in microservices systems. Event-driven systems have three key components: producers, consumers, and
Tweet media one
3
106
547
@mjovanovictech
Milan Jovanović
17 days
I just received the Microsoft MVP award for the 2nd year in a row. What an awesome way to start my vacation. 😁 #MVPBuzz
Tweet media one
51
15
543
@mjovanovictech
Milan Jovanović
9 months
Microsoft just revealed its secret project - .NET Aspire. Here's everything you need to know. 👇 What is .NET Aspire? .NET Aspire is an opinionated, cloud-ready stack for building observable, production-ready, distributed applications. .NET Aspire helps with: - Orchestration
Tweet media one
Tweet media two
Tweet media three
Tweet media four
7
97
514
@mjovanovictech
Milan Jovanović
6 months
CQRS = Separate read/write databases? Not so fast! ❌ This isn't really what CQRS is about. First, there was the CQS - Command-Query Separation principle. Here's what CQS is: - Commands change state, don't return data - Queries don't change state, return data - Queries
Tweet media one
7
126
528
@mjovanovictech
Milan Jovanović
10 months
𝗢𝗻𝗶𝗼𝗻 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 vs. 𝗖𝗹𝗲𝗮𝗻 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 - is there a difference? Both architectures have a similar visual representation using concentric circles. The Onion architecture has: - Domain entities - Repository interfaces - Service interfaces -
Tweet media one
Tweet media two
Tweet media three
Tweet media four
11
115
529
@mjovanovictech
Milan Jovanović
7 months
Here are 13 excellent libraries I use in my projects: 1. MediatR 2. Serilog 3. Scrutor 4. EF Core 5. Hangfire 6. SignalR 7. YARP 8. MassTransit 9. FluentValidation 10. Serilog.Sinks.Seq 11. xUnit 12. NSubstitute 13. FluentAssertions What would you add to the
38
69
519
@mjovanovictech
Milan Jovanović
7 months
What is API Observability? There are 4 pillars of API observability: - Metrics - Events - Logs - Traces Metrics measure values that determine API health. A few interesting metrics are throughput, latency, CPU usage, and memory usage. Events capture significant changes in the
Tweet media one
5
123
501
@mjovanovictech
Milan Jovanović
7 months
Using in-memory databases for "integration" testing is a waste of time. I've seen folks do this with the EF in-memory provider. That's not even a real database. So, what value can those "integration" tests have? Zero, if you ask me. Instead, spin up an actual database using
Tweet media one
19
85
487
@mjovanovictech
Milan Jovanović
1 year
I've been using Clean Architecture for 5 years and counting. Here's why I think it's amazing. 👇 Clean architecture isn't revolutionary. But it is opinionated about how to structure your code. It's just another form of layered architecture.
Tweet media one
15
118
497
@mjovanovictech
Milan Jovanović
8 months
You can use CQRS to build fast and scalable applications. The CQRS pattern separates the writes and reads in the application. This separation can be logical or physical and has many benefits: - Complexity management - Improved performance - Scalability - Flexibility - Security
Tweet media one
6
95
498
@mjovanovictech
Milan Jovanović
7 months
Do you want to learn Domain-Driven Design? Here are 21 free resources to fast-track your journey. 🔥 1. What is an Entity - 2. What is a Value Object - 3. What is an Aggregate Root - 4. Domain validation
Tweet media one
6
98
497
@mjovanovictech
Milan Jovanović
9 months
𝗪𝗵𝗮𝘁 𝗶𝘀 𝗮 𝗪𝗲𝗯𝗵𝗼𝗼𝗸? Imagine this: You have an application, and you want it to automatically do things without you having to trigger them manually. That's where webhooks come in! Webhooks are like messengers that allow one system to send a message to another
Tweet media one
8
94
496
@mjovanovictech
Milan Jovanović
9 months
How do you apply the 𝗖𝗤𝗥𝗦 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 to your system? Here's my approach to implementing the 𝗹𝗼𝗴𝗶𝗰𝗮𝗹 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲. I prefer using MediatR - but this idea works fine without it. MediatR implements the mediator pattern. It decouples the in-process
Tweet media one
7
91
485
@mjovanovictech
Milan Jovanović
2 years
Here are three books that made me a better software engineer: 1. Domain-Driven Design, Eric Evans 2. Designing Data-Intensive Applications, Martin Kleppmann 3. The Effective Engineer, Edmond Lau Which book left an impact on you?
44
59
486
@mjovanovictech
Milan Jovanović
8 months
What is API versioning, and why is it important? It's a critical concept to understand if you're building APIs. Here's a fun story from a project I worked on. I was building a public API that had dozens of integrations. Many (independent) mobile applications use the API to
Tweet media one
12
104
480
@mjovanovictech
Milan Jovanović
8 months
Don't build Microservices without an API Gateway. An API Gateway is a critical component of a Microservice-based system. But what is an API Gateway in the first place? It acts as a reverse proxy and routes client requests to the appropriate services. API Gateways hide
Tweet media one
13
99
482
@mjovanovictech
Milan Jovanović
1 year
What is a webhook? Imagine this: You have a website or an application, and you want it to automatically do things without you having to trigger them manually. That's where webhooks come in!
Tweet media one
19
100
478
@mjovanovictech
Milan Jovanović
9 months
𝗜𝗘𝘅𝗰𝗲𝗽𝘁𝗶𝗼𝗻𝗛𝗮𝗻𝗱𝗹𝗲𝗿 𝗶𝘀 𝗮 𝗻𝗲𝘄 𝗳𝗲𝗮𝘁𝘂𝗿𝗲 𝗶𝗻 𝗔𝗦𝗣 .𝗡𝗘𝗧 𝗖𝗼𝗿𝗲 𝟴. I'm not a fan of exceptions, but I think this is an excellent feature. Exceptions are for exceptional situations. But you have to handle exceptions regardless. The
Tweet media one
10
65
476
@mjovanovictech
Milan Jovanović
5 months
Can't wait to share my review of this one. 😁
Tweet media one
4
47
476
@mjovanovictech
Milan Jovanović
1 year
Amazon's Prime Video team migrated one system from Microservices to a Monolith. And reduced cloud costs by 90%. Here are the most important takeaways:
Tweet media one
19
112
469
@mjovanovictech
Milan Jovanović
7 months
The Application layer in Clean Architecture should express intent. It's part of the application core and contains the use cases. Use cases represent a small functionality of your application: - Get me the current user - Transfer funds between accounts - Send this order
Tweet media one
23
83
456
@mjovanovictech
Milan Jovanović
1 year
Which ORM is better for your .NET project? - 𝗘𝗙 𝗖𝗼𝗿𝗲 - 𝗗𝗮𝗽𝗽𝗲𝗿 Let's compare them on: - Level of abstraction - Performance - Features
Tweet media one
28
108
456
@mjovanovictech
Milan Jovanović
19 days
𝗪𝗵𝗮𝘁 𝗶𝘀 𝗮 𝗪𝗲𝗯𝗵𝗼𝗼𝗸? Here's an example to help you understand it. You have an application, and you want it to automatically do things without you having to trigger them manually. That's where webhooks come in! Webhooks are like messengers, allowing one system to
Tweet media one
4
103
464
@mjovanovictech
Milan Jovanović
9 months
What is an API Gateway, and why do you need it for Microservices? An API Gateway is a critical component of a Microservice-based system. It acts as a reverse proxy and routes client requests to the appropriate services. Here are 6 use cases for an API gateway: - Request
Tweet media one
12
89
458
@mjovanovictech
Milan Jovanović
8 months
What is the RIGHT way to use HttpClient in .NET? HttpClient is an excellent abstraction and incredibly easy to work with. Unfortunately, it's also easy to misuse, leading to problems like port exhaustion. You need to know how NOT to use it. If you think IHttpClientFactory
Tweet media one
10
55
455
@mjovanovictech
Milan Jovanović
1 month
Finally, I can test my APIs without leaving VS Code. And so can you. Here's how. 👇 Postman's VS Code extension is now GA (generally available). The VS Code extension enables you to develop and test your APIs in Postman without ever leaving VS Code. This is a massive
10
90
452
@mjovanovictech
Milan Jovanović
11 months
I spent 4 years studying Domain-Driven Design, so you don't have to. Here are the 9 most important DDD patterns. 👇 1. Bounded Contexts Instead of having one large and complex domain - you split it into smaller, more manageable parts. Each part has its distinct model and
16
90
444
@mjovanovictech
Milan Jovanović
7 months
Here are 5 books that made me a better software engineer: 1. Clean Architecture, Robert C. Martin 2. Domain-Driven Design, Eric Evans 3. Domain Modelling Made Functional, Scott Wlaschin 4. Designing Data-Intensive Applications, Martin Kleppmann 5. The Effective
16
62
443
@mjovanovictech
Milan Jovanović
10 months
𝗗𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝗰𝘆 𝗶𝗻𝘃𝗲𝗿𝘀𝗶𝗼𝗻 is one of the core principles of Clean architecture. But what is the dependency inversion principle? This principle establishes two rules: 1. Inner layers should not reference outer layers. But they should depend on abstractions
Tweet media one
Tweet media two
6
111
445
@mjovanovictech
Milan Jovanović
1 year
What is a Modular Monolith, and why should I care? I see some confusion around this topic that I want to clear up. I've held two talks so far talking about this architecture. How I define a Modular Monolith in simple terms is: • A monolith system designed in a modular way
Tweet media one
13
83
444
@mjovanovictech
Milan Jovanović
7 months
How do you implement API Versioning in ASP .NET Core? In the past year, I built and maintained a large public API. The API has dozens of integrations, serving mainly mobile applications. When your API is serving so many clients, breaking changes are expensive. So, everything
Tweet media one
7
70
438
@mjovanovictech
Milan Jovanović
1 year
Here are 3 books that made me a better software engineer: 1. Domain-Driven Design, Eric Evans 2. Designing Data-Intensive Applications, Martin Kleppmann 3. The Effective Engineer, Edmond Lau Which book left an impact on you?
36
63
443
@mjovanovictech
Milan Jovanović
1 year
Rate limiting can make your APIs more robust and secure. It's a technique to limit the number of requests to a server or an API. There are four popular rate limit algorithms: - Fixed window - Sliding window - Token bucket - Concurrency The best part is that they're now
Tweet media one
14
65
436
@mjovanovictech
Milan Jovanović
15 days
Here are 5 underappreciated LINQ methods you should know: - Zip - Chunk - OfType - DistinctBy - SelectMany LINQ is full of gems that can make your code cleaner and more efficient. Here are 5 more honorable mentions that didn't make the cut: - SequenceEqual -
Tweet media one
4
71
442
@mjovanovictech
Milan Jovanović
9 months
Why bad developers fail: - Read the task description - Start writing code - Run into a wall - Head to StackOverflow - Find a solution to try - Copy & paste code - Get stuck again - Delete everything - Start from scratch - Ask for help How successful developers solve problems:
28
58
430
@mjovanovictech
Milan Jovanović
8 months
What is the cleanest way to get configuration values in .NET? I use the Options pattern, and here's why you should know about it. App configuration lives in environment variables or JSON files. You can get individual values using the `IConfiguration` interface. But
Tweet media one
9
51
430
@mjovanovictech
Milan Jovanović
8 months
StackOverflow and Shopify are running a Modular Monolith architecture. What do they know that you don't? I've held two talks so far about Modular monoliths. Modular monoliths combine the qualities of monolithic and microservices architectures. It's like they take the best of
Tweet media one
21
79
420
@mjovanovictech
Milan Jovanović
1 year
Unit Tests vs. Integration Tests Both are important for ensuring the quality and stability of my code. But, the balance between the two types of tests will depend on the specific needs of your project. Unit tests are there to test individual units of code in isolation.
Tweet media one
10
91
428
@mjovanovictech
Milan Jovanović
11 months
Monolith vs. Microservices - Which one is better? Let's compare them and find out. Monolith: • One application - deployment unit • One database • Method calls • One network Microservices; • Many applications - deployment units • Many databases • Network calls •
Tweet media one
Tweet media two
Tweet media three
Tweet media four
13
95
424
@mjovanovictech
Milan Jovanović
1 year
I've now been creating YouTube videos for an entire year. - 3,000,000 views - 136,000 hours of watch time (~15.5 years 🤯) - 43,000+ amazing subscribers - 2 videos/week for 52 weeks straight I had NO IDEA what I was doing. But here's my secret: - I JUST STARTED
Tweet media one
29
26
422
@mjovanovictech
Milan Jovanović
8 months
5 things you need to build (almost) any API in .NET: - ASP .NET Core - Logging (Serilog) - ORM (EF, Dapper) - Background jobs (Hangfire) - Authentication (Identity, JWT) Mastering these concepts gets you pretty far. Then, you can think about distributed system
18
52
421
@mjovanovictech
Milan Jovanović
8 months
Don't start with Microservices. ❌ Even if you're confident that your application will be big enough to justify it. And here's why. 👇 Microservices come with a premium: - Team coordination - Dealing with failure - Eventual consistency - Automating deployments -
Tweet media one
6
71
412
@mjovanovictech
Milan Jovanović
21 days
𝗛𝗮𝗻𝗱𝗹𝗶𝗻𝗴 𝗱𝘂𝗽𝗹𝗶𝗰𝗮𝘁𝗲 𝗺𝗲𝘀𝘀𝗮𝗴𝗲𝘀 𝗶𝗻 𝗮𝗻 𝗲𝘃𝗲𝗻𝘁-𝗱𝗿𝗶𝘃𝗲𝗻 𝘀𝘆𝘀𝘁𝗲𝗺 📨📨 What happens when a message is retried in an event-driven system? This could happen for several reasons. The broker can retry publishing a message due to a network
Tweet media one
4
65
416
@mjovanovictech
Milan Jovanović
7 months
I failed an interview because I didn't know this. So, I'm making this post to make sure it never happens to you. Locking allows us to control how many threads can access some section in the code. Why would you want to do this? Because you want to protect access to expensive
Tweet media one
13
58
403
@mjovanovictech
Milan Jovanović
7 months
Monolith vs. Microservices - Which one is better? Let's do a side-by-side comparison. 𝗠𝗼𝗻𝗼𝗹𝗶𝘁𝗵: - One application - one deployment unit - One database - atomic, transactional - Method calls - fast, reliable - One network 𝗠𝗶𝗰𝗿𝗼𝘀𝗲𝗿𝘃𝗶𝗰𝗲𝘀: - Many
Tweet media one
16
88
403
@mjovanovictech
Milan Jovanović
10 months
The Outbox pattern is a game changer. 📦 Here's everything you need to know. The Outbox pattern is a technique for reliable messaging in a microservices system. Here's the gist of the Outbox pattern: - You don't publish events to a queue - Instead, you store them in the
Tweet media one
Tweet media two
Tweet media three
Tweet media four
30
83
405
@mjovanovictech
Milan Jovanović
7 months
Two types of message-driven communication you need to know: - Orchestration - Choreography Working with distributed systems is both fun and challenging at the same time. One of those challenges is designing effective communication between services. More centralization or less
Tweet media one
3
86
397
@mjovanovictech
Milan Jovanović
9 months
What is the Saga pattern? A Saga is a sequence of local transactions, where each local transaction updates the Saga state and publishes a message triggering the next step in the Saga. Sagas come in two forms: - Orchestrated - Choreographed
Tweet media one
8
64
405
@mjovanovictech
Milan Jovanović
11 months
The biggest lie about CQRS: - You need separate read/write databases The truth is, you can have one database and still be doing CQRS. You also don't need event sourcing. Here's what CQRS is: - Logical separation of reads & writes - Commands change state, return void -
35
53
399
@mjovanovictech
Milan Jovanović
6 months
How do you design a good API? Here are 5 tips for designing a quality API. API design is deciding how your API will expose data and functionality to consumers. A good API design describes the API endpoints and resources in some standard format. There are 4 key stages of API
Tweet media one
9
92
395
@mjovanovictech
Milan Jovanović
11 months
Here's my approach for the Clean Architecture folder structure. 📂 I focus on features, not types. Let's use the Application layer for the example: 📁 Application |__ 📁 FeatureFolder1 |_____ 📁 Feature1A |_____ 📁 Feature1B |__ 📁 FeatureFolder2 |_____ 📁 Feature2A
31
50
397
@mjovanovictech
Milan Jovanović
1 month
What's the fastest way to do a SQL bulk insert? Whether you're building a data analytics platform, migrating a legacy system, or onboarding a surge of new users, you will likely need to insert a massive amount of data into your database at some point. Understanding fast
Tweet media one
6
65
399
@mjovanovictech
Milan Jovanović
5 months
What is API Observability? There are 4 pillars of API observability: - Metrics - Events - Logs - Traces
Tweet media one
6
77
391
@mjovanovictech
Milan Jovanović
8 months
I've been using Clean Architecture for 5+ years and counting. Here's why I think it's amazing. 👇 Clean architecture isn't revolutionary. But it has some rules about how to structure your code. It's another form of layered architecture. But you need to follow one crucial
Tweet media one
Tweet media two
Tweet media three
Tweet media four
7
88
392
@mjovanovictech
Milan Jovanović
6 months
How would you build a URL shortener in .NET? URL shorteners have two core functionalities: - Generating a unique code for a given URL - Redirecting users who access the short link to the original URL A URL shortener converts long URLs into more manageable, shorter versions.
Tweet media one
7
56
386
@mjovanovictech
Milan Jovanović
3 months
Here are 13 excellent libraries I use in my projects: 1. MediatR 2. Serilog 3. Scrutor 4. EF Core 5. Dapper 6. SignalR 7. Quartz 8. MassTransit 9. FluentValidation 10. Serilog.Sinks.Seq 11. StackExchange.Redis 12. AspNetCore.HealthChecks 13. OpenTelemetry.Instrumentation.* What
38
46
385
@mjovanovictech
Milan Jovanović
6 months
I just finished reading 𝗔𝗽𝗽𝘀 𝗮𝗻𝗱 𝗦𝗲𝗿𝘃𝗶𝗰𝗲𝘀 𝘄𝗶𝘁𝗵 .𝗡𝗘𝗧 𝟴 📘 Here are my thoughts after reading it. Apps and Services with .NET 8 covers every technology needed to build a modern application with .NET. And I'm not even exaggerating here. There's even a
Tweet media one
18
47
382
@mjovanovictech
Milan Jovanović
1 year
Why should you use Clean Architecture? I've been using it for 6 years, and here's my experience. Clean Architecture gives you a standard for organizing your solution. You don't have to reinvent the wheel every time at the start of the project.
Tweet media one
9
74
381
@mjovanovictech
Milan Jovanović
1 year
You should never return null collections in C#. There are better solutions. What problem does returning null collections cause? Collections are typically iterated over in a loop. If your method returns null collections, this can lead to potential errors. The calling code
Tweet media one
17
56
382
@mjovanovictech
Milan Jovanović
1 year
Here are 10 excellent libraries I use in my projects: 1. MediatR 2. FluentValidation 3. Serilog 4. Refit 5. Polly 6. Entity Framework Core 7. StackExchange.Redis 8. MassTransit 9. Mapster 10. SonarAnalyzer.CSharp
20
59
385
@mjovanovictech
Milan Jovanović
1 year
I spent 3 days optimizing an API endpoint to make it 15x faster. Here are my secrets. I faced an issue with an API endpoint for an e-commerce web application that was not scaling well. The endpoint was responsible for calculating a report.
17
93
381
@mjovanovictech
Milan Jovanović
11 months
I failed an interview because I didn't know this. So I'm making this post to make sure it never happens to you. Locking allows us to control how many threads can access some section in the code. Why would you want to do this? Because you want to protect access to expensive
Tweet media one
15
64
383
@mjovanovictech
Milan Jovanović
10 months
𝗠𝗮𝘀𝘀𝗧𝗿𝗮𝗻𝘀𝗶𝘁 𝗶𝘀 𝗮 𝗴𝗮𝗺𝗲 𝗰𝗵𝗮𝗻𝗴𝗲𝗿 𝗳𝗼𝗿 𝗯𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗱𝗶𝘀𝘁𝗿𝗶𝗯𝘂𝘁𝗲𝗱 𝗮𝗽𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗼𝗻𝘀. And it makes the whole process incredibly simple. It's a .NET library that gives you all the tools you need to build modern distributed systems. The
Tweet media one
Tweet media two
Tweet media three
Tweet media four
11
65
384
@mjovanovictech
Milan Jovanović
11 months
What is the cleanest way to get configuration values in .NET? I use the Options pattern, and here's why you. App configuration lives in environment variables or JSON files. You can get individual values using the `IConfiguration` interface. But this is error-prone and
Tweet media one
12
50
378
@mjovanovictech
Milan Jovanović
11 months
How can you enforce your software architecture rules? Architecture tests. These are automated tests that verify the structure and design of your code. You can use them to enforce design rules expressed with C# code. - Enforce the direction of project dependencies - Define
Tweet media one
Tweet media two
Tweet media three
10
63
376
@mjovanovictech
Milan Jovanović
9 months
𝗠𝗼𝗱𝘂𝗹𝗮𝗿 𝗺𝗼𝗻𝗼𝗹𝗶𝘁𝗵𝘀 can quickly scale out to 𝗺𝗶𝗰𝗿𝗼𝘀𝗲𝗿𝘃𝗶𝗰𝗲𝘀. All you need is: - Clearly defined boundaries (modules) - Way for modules to communicate - Good data isolation in the database The migration comes down to extracting a module into a new
Tweet media one
5
89
376
@mjovanovictech
Milan Jovanović
9 months
How do you 𝗵𝗮𝗻𝗱𝗹𝗲 𝗲𝗿𝗿𝗼𝗿𝘀 in your code? This has been a topic of many discussions, and I want to share my opinion. One school of thought suggests using exceptions for flow control. Using exceptions for flow control is an approach to implement the fail-fast
Tweet media one
22
60
373
@mjovanovictech
Milan Jovanović
10 months
C# has been getting many new features in recent versions. And one that stands out is 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 𝗺𝗮𝘁𝗰𝗵𝗶𝗻𝗴. What is it? Pattern matching lets you check if an object has specific characteristics: - Is null or is not null - Is of a particular type - Property has a
Tweet media one
18
57
373
@mjovanovictech
Milan Jovanović
5 months
What is a Webhook? Here's an example to help you understand it. You have an application, and you want it to automatically do things without you having to trigger them manually. That's where webhooks come in! Webhooks are like messengers, allowing one system to send a message
Tweet media one
7
70
372
@mjovanovictech
Milan Jovanović
2 years
C# Tip 💡 Did you know you can use expression-body constructors? It was introduced in C# 7. You can specify your arguments using a tuple and deconstruct them into your property values. The result is being able to write your constructor as an expression. #dotnet
Tweet media one
18
64
375
@mjovanovictech
Milan Jovanović
4 months
I've been using Clean Architecture for 5+ years. Here's why I think it's amazing. 👇 The biggest pain point I see with enterprise applications is a lack of structure. Every project uses a different approach. It's difficult to transfer technical knowledge from one system to
Tweet media one
Tweet media two
Tweet media three
Tweet media four
9
81
365
@mjovanovictech
Milan Jovanović
6 months
The average software architect's salary is $137,729 (source: indeed). It's a challenging role, no doubt. You need to have excellent tech skills. The fundamental knowledge revolves around software architecture. For example, you should know what a Modular monolith is.
Tweet media one
4
62
368
@mjovanovictech
Milan Jovanović
1 month
.𝗡𝗘𝗧 𝟴 𝗴𝘂𝗮𝗿𝗱 𝗰𝗹𝗮𝘂𝘀𝗲𝘀 𝘁𝗼 𝗰𝗹𝗲𝗮𝗻 𝘂𝗽 𝘆𝗼𝘂𝗿 𝗰𝗼𝗱𝗲 What's the simplest way to add a guard clause for null values? .NET 6 introduced an ArgumentNullException.ThrowIfNull guard clause. .NET 7 added ArgumentException.ThrowIfNullOrEmpty. And in .NET 8?
Tweet media one
11
52
369
@mjovanovictech
Milan Jovanović
10 months
𝗢𝗿𝗰𝗵𝗲𝘀𝘁𝗿𝗮𝘁𝗶𝗼𝗻 is a centralized approach to microservices communication. One of the services takes on the role of the orchestrator and coordinates the communication between services. Orchestration uses command-driven communication. The command communicates the
Tweet media one
6
70
363