.NET 9 will have a new Lock() type 🔒
Great to have a dedicated lock type as it gives us a way to express the intent of our code more clearly.
Thanks to Steven Giesel on LinkedIn for the image ->
https://t.co/PuytOEhfDX
#dotnet
Why bad developers fail:
- Read the task description
- Start writing code
- Run into a problem
- Find a solution to try
- Copy & paste code
- Get stuck again
- Delete everything
- Start from scratch
- Ask for help...
How successful developers solve problems:
- Read the task description
- Brainstorm many solutions
- Pick the best solution
- Make a good plan
- Write the tests* (TDD)
- Write the code
- Write the tests
- Refactor
- Optimize
Spend more time thinking.
Solve more problems.
Efficiency >>> Being busy
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
- Components
- Tooling
Orchestration refers to coordinating and managing various elements within a cloud-native application.
.NET Aspire streamlines the configuration and interconnection of different parts of your cloud-native app.
It provides useful abstractions for managing:
- Service discovery
- Environment variables
- Container configurations
Without you having to handle low-level implementation details.
My favorite feature is the built-in Aspire dashboard.
You can use it to monitor:
- Containers
- Structured logs
- Applications traces
- Applications metrics
But there are even more fantastic things inside.
What about deploying an Aspire application?
NET Aspire applications are built with cloud-agnostic principles in mind.
This allows you to deploy Aspire apps across various platforms supporting .NET and containers.
With .NET Aspire (Preview 1), you can deploy to Azure Container Apps.
This is doable through a few simple commands using the Azure CLI.
I'm excited about the Aspire project and will create more content about it on my YouTube channel and newsletter.
If you enjoyed this, you will love The .NET weekly newsletter.
More than 32,000+ engineers already read it.
Subscribe here: https://t.co/xip45XpWuB
What's your first impression of .NET Aspire?
SOLID principle is one of the most important design principles in OOP languages like Java, Python, C#, etc.
Sadly, most of the programmers find it super difficult to understand.
Here's the simplest guide to understand SOLID principles:
Are "blueprint" architectures bad?
No, I don't think so. And here's why.
I think a blueprint architecture can be excellent for some teams.
One example of a prescriptive architecture is Clean Architecture.
- Domain layer at the core
- Application layer with use cases
- External concerns on the outskirts
- Dependencies should point inwards
You can have more (or fewer) layers if you want to. It's not set in stone.
Clean architecture isn't revolutionary.
But it's prescriptive about how you should structure the code.
And for some teams, this can be all they need.
You have to understand this - not all teams have much experience with software architecture.
Here are a few qualities of Clean Architecture:
- Maintainability
- Testability
- Loose coupling
- Separation of concerns
Clean Architecture gives you a solid foundation to build your project.
And most projects can deliver value to customers with a solid foundation.
When a team lacks software architect expertise, a blueprint architecture does the job.
The Clean Architecture is fantastic for complex projects.
P.S. If you liked this, consider joining The .NET Weekly - my newsletter with 29,000+ engineers.
Join free here: https://t.co/S3OBDGSLNl
What do you think about this architecture?
REPOST = Teach your audience about Clean architecture ♻️
𝗙𝗹𝘂𝗲𝗻𝘁𝗩𝗮𝗹𝗶𝗱𝗮𝘁𝗶𝗼𝗻 is one of the most powerful 𝘃𝗮𝗹𝗶𝗱𝗮𝘁𝗶𝗼𝗻 𝗹𝗶𝗯𝗿𝗮𝗿𝗶𝗲𝘀 in .NET.
And in 2 minutes, I'll teach you all the basics so you can start using it.
FluentValidation uses a fluent interface and lambda expressions for building strongly-typed validation rules.
You start by inheriting from the AbstractValidator<T> base class.
To specify a validation rule for a particular property, call the RuleFor method.
From there, you can write rules ensuring properties are:
- Not null
- Not empty
- Have a min/max length
- Are equal/not equal to some value
- Define your completely custom rule
It also supports complex properties and collections.
It's easy to write asynchronous validation rules using the MustAsync method.
What about dependency injection? It's supported.
To run the validation, you call the Validate method, which returns a ValidationResult.
The ValidationResult tells you if the validation passed and if there are any errors.
If you liked this, consider joining The .NET Weekly - my newsletter with 29,000+ engineers.
Join us here → https://t.co/S3OBDGSLNl
Have you used FluentValidation before?
Want to build a large-scale system?
You will need rate limiting sooner or later.
It's a technique to limit the number of requests hitting your API:
- Improves security
- Prevents overloading
- Reduces resource usage
.NET 7 has built-in rate-limiting support.