๐ง๐ผ๐ฝ ๐ญ๐ฌ ๐บ๐ผ๐๐ ๐ต๐ฎ๐ฟ๐บ๐ณ๐๐น ๐ก๐๐๐ฒ๐ ๐ฝ๐ฎ๐ฐ๐ธ๐ฎ๐ด๐ฒ๐ ๐๐ผ๐'๐ฟ๐ฒ ๐๐๐ถ๐ป๐ด ๐๐ถ๐๐ต๐ผ๐๐ ๐ฟ๐ฒ๐ฎ๐น๐ถ๐๐ถ๐ป๐ด ๐ถ๐!
You might think these popular .NET packages make your life easier โ but they often introduce hidden issues ๐
1๏ธโฃ ๐๐๐๐ผ๐ ๐ฎ๐ฝ๐ฝ๐ฒ๐ฟ
Encourages overly-complex mapping logic hidden behind profiles. AutoMapper is slow and makes debugging almost impossible.
๐ Better choice: Manual mapping
2๏ธโฃ ๐ ๐ฒ๐ฑ๐ถ๐ฎ๐๐ฅ
Adds unnecessary reflection overhead and complexity.
๐ Better choice: Own manual handlers
3๏ธโฃ ๐ก๐ฒ๐๐๐ผ๐ป๐๐ผ๐ณ๐.๐๐๐ผ๐ป
Heavy and slower compared to newer, built-in options.
๐ Better choice: System.Text.Json
4๏ธโฃ ๐๐น๐๐ฒ๐ป๐๐๐๐๐ฒ๐ฟ๐๐ถ๐ผ๐ป๐
Now has a paid license for commercial use.
๐ Better choice: Shouldly or xUnit assertions
5๏ธโฃ ๐ฅ๐ฒ๐๐๐ฆ๐ต๐ฎ๐ฟ๐ฝ
Has become outdated and less intuitive compared to modern HTTP clients.
๐ Better choice: Refit
6๏ธโฃ ๐๐๐๐ผ๐๐ฎ๐ฐ
Outdated DI container adding unnecessary complexity.
๐ Better choice: Microsoft DI
7๏ธโฃ NServiceBus
Expensive licensing model in production and complex setup.
๐ Better choice: MassTransit, Wolverine
8๏ธโฃ ๐๐๐๐ผ๐๐ถ๐ ๐๐๐ฟ๐ฒ
Produces unrealistic, hard to understand tests with randomly-generated data.
๐ Better choice: Bogus
9๏ธโฃ ๐ก๐ฆ๐๐ฏ๐๐๐ถ๐๐๐๐ฒ
Its syntax uses the original interface, leading to confusing, unclear tests.
๐ Better choice: Moq
๐ ๐ก๐จ๐ป๐ถ๐
Older, verbose framework with outdated practices.
๐ Better choice: xUnit
Which harmful packages are you still using in your projects? Drop in the comment below! ๐
โป๏ธ Repost to help your network learn about harmful NuGet packages
โ Follow me (@AntonMartyniuk) for more
#Dotnet
๐ต๐ฌ% ๐ผ๐ณ ๐๐ฃ๐๐ ๐ฎ๐ฟ๐ฒ ๐ป๐ผ๐ ๐ฅ๐๐ฆ๐ง๐ณ๐๐น
Web APIs can't be fully RESTful without a GPS ๐
According to Richardson's REST Maturity Model, there are four levels of REST APIs:
โข Level 0 (Swamp of POX): Plain XML or JSON with a single endpoint.
โข Level 1 (Resources): Separate resources with unique URIs.
โข Level 2 (HTTP Verbs): Proper HTTP methods (GET, POST, PUT, DELETE, PATCH).
โข Level 3 (HATEOAS): APIs provide links dynamically, guiding clients through possible actions and states.
Most APIs are stuck at level 2, missing the ๐๐๐ง๐๐ข๐๐ฆ.
HATEOAS: Hypermedia as the Engine of Application State.
Why should you care?
Without HATEOAS, your clients are tightly coupled to endpoints, causing costly changes and maintenance.
๐๐๐ง๐๐ข๐๐ฆ ๐ถ๐ ๐๐ฃ๐ฆ ๐ณ๐ผ๐ฟ ๐๐ฃ๐๐:
โณ Dynamically guides API clients through the available actions and states using embedded links
โณ Provides directions to navigate routes, HATEOAS gives clients clear paths to interact with your API without hard-coding specific endpoints
โณ This flexibility ensures your API remains robust and easy to integrate, even as it evolves.
โ Without HATEOAS, the frontend copies business checks from the backend to determine whether to put an "update" button or not. Often, backend and frontend can go out of sync, leading to bugs.
โ With HATEOAS, server sends the "Update Link" to the frontend. No need to re-implement complex business checks to determine whether a user is allowed to update the resource.
This approach shifts complexity to one place โ the backend, where it belongs.
Are you integrating HATEOAS into your APIs, or are they still stuck at Level 2?
Let me know in the comments below ๐
โป๏ธ Follow me @AntonMartyniuk and repost this to help others
โถ๏ธ Subscribe to my free newsletter to learn how to craft better Web APIs:
โณ https://t.co/bSLiKbOlRR
#dotnet
What is the Chain Responsibility Pattern?
When should I implement it?
How to implement it?
Theย Chain of Responsibilityย Pattern allows us to easily separate dependent parts to make code more extensible and testable.
In simple words, we can say that the chain of responsibility design pattern creates a chain of receiver objects for a given request.
In this design pattern, normally each receiver contains a reference to another receiver. If one receiver cannot handle the request then it passes the same request to the next receiver and so on.ย One receiver handles the request in the chain or one or more receivers handle the request.
I explained and implemented it in my newsletter issue. If you are interested in learning how it works, check it out here: https://t.co/0pLNKnt38K
Be sure not to miss the next one.
Join 8500+ engineers here:ย https://t.co/jHf5a4qQTZ
Integration tests using Docker?
The Testcontainers library can spin up a Docker container inside your test.
I use it to create a PostgreSQL instance, so my test can now run using a real database.
Go from 0 to Hero by watching my Testconatiners video ๐
https://t.co/GFgDJfQisF
How to find slow queries in Entity Framework โฌ
By using Entity Frameworks interceptor system and hooking into the ReaderExecuted event we can see exactly how long queries are taking to execute.
Bookmark it!
#dotnet#efcore
I implemented API Key authentication for a .NET 7 project.
Here's what I learned.
API key authentication is a method of identifying and granting access to specific users or systems that need to consume an API.
The client passes an API Key that is used to authenticate it.
Docker vs. Kubernetes. Which one should we use?
What is Docker ?
Docker is an open-source platform that allows you to package, distribute, and run applications in isolated containers. It focuses on containerization, providing lightweight environments that encapsulate applications and their dependencies.
What is Kubernetes ?
Kubernetes, often referred to as K8s, is an open-source container orchestration platform. It provides a framework for automating the deployment, scaling, and management of containerized applications across a cluster of nodes.
How are both different from each other ?
Docker: Docker operates at the individual container level on a single operating system host.
You must manually manage each host and setting up networks, security policies, and storage for multiple related containers can be complex.
Kubernetes: Kubernetes operates at the cluster level. It manages multiple containerized applications across multiple hosts, providing automation for tasks like load balancing, scaling, and ensuring the desired state of applications.
In short, Docker focuses on containerization and running containers on individual hosts, while Kubernetes specializes in managing and orchestrating containers at scale across a cluster of hosts.
Over to you: What challenges prompted you to switch from Docker to Kubernetes for managing containerized applications?
โ
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/4QcX8btXGL
C# Tip ๐ก
Did you know you can use ๐ฒ๐ ๐ฝ๐ฟ๐ฒ๐๐๐ถ๐ผ๐ป-๐ฏ๐ผ๐ฑ๐ ๐ฐ๐ผ๐ป๐๐๐ฟ๐๐ฐ๐๐ผ๐ฟ๐?
Expression body constructors have been available since C# 7.
You specify the arguments using a tuple and deconstruct them into the property values.
What are the most common ๐จ๐๐ฒ ๐๐ฎ๐๐ฒ๐ ๐ณ๐ผ๐ฟ ๐๐ฎ๐ณ๐ธ๐ฎ?
We have covered lots of concepts around Kafka already. But what are the most common use cases for The System that you are very likely to run into as a Data Engineer?
๐๐ฒ๐โ๐ ๐๐ฎ๐ธ๐ฒ ๐ฎ ๐ฐ๐น๐ผ๐๐ฒ๐ฟ ๐น๐ผ๐ผ๐ธ:
๐ช๐ฒ๐ฏ๐๐ถ๐๐ฒ ๐๐ฐ๐๐ถ๐๐ถ๐๐ ๐ง๐ฟ๐ฎ๐ฐ๐ธ๐ถ๐ป๐ด.
โก๏ธ The Original use case for Kafka by LinkedIn.
โก๏ธ Events happening in the website like page views, conversions etc. are sent via a Gateway and piped to Kafka Topics.
โก๏ธ These events are forwarded to the downstream Analytical systems or processed in Real Time.
โก๏ธ Kafka is used as an initial buffer as the Data amounts are usually big and Kafka guarantees no message loss due to its replication mechanisms.
๐๐ฎ๐๐ฎ๐ฏ๐ฎ๐๐ฒ ๐ฅ๐ฒ๐ฝ๐น๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป.
โก๏ธ Database Commit log is piped to a Kafka topic.
โก๏ธ The committed messages are executed against a new Database in the same order.
โก๏ธ Database replica is created.
๐๐ผ๐ด/๐ ๐ฒ๐๐ฟ๐ถ๐ฐ๐ ๐๐ด๐ด๐ฟ๐ฒ๐ด๐ฎ๐๐ถ๐ผ๐ป.
โก๏ธ Kafka is used for centralized Log and Metrics collection.
โก๏ธ Daemons like FluentD are deployed in servers or containers together with the Applications to be monitored.
โก๏ธ Applications send their Logs/Metrics to the Daemons.
โก๏ธ The Daemons pipe Logs/Metrics to a Kafka Topic.
โก๏ธ Logs/Metrics are delivered downstream to storages like ElasticSearch or InfluxDB for Log/Metrics discovery respectively.
โก๏ธ This is also how you would track your IoT Fleets.
๐ฆ๐๐ฟ๐ฒ๐ฎ๐บ ๐ฃ๐ฟ๐ผ๐ฐ๐ฒ๐๐๐ถ๐ป๐ด.
โก๏ธ This is usually coupled with ingestion mechanisms already covered.
โก๏ธ Instead of piping Data to a certain storage downstream we mount a Stream Processing Framework on top of Kafka Topics.
โก๏ธ The Data is filtered, enriched and then piped to the downstream systems to be further used according to the use case.
โก๏ธ This is also where one would be running Machine Learning Models embedded into a Stream Processing Application.
๐ ๐ฒ๐๐๐ฎ๐ด๐ถ๐ป๐ด.
โก๏ธ Kafka can be used as a replacement for more traditional messaging brokers like RabbitMQ.
โก๏ธ Kafka has better durability guarantees and is easier to configure for several separate Consumer Groups to consume from the same Topic.
โ๏ธHaving said this - always consider the complexity you are bringing with introduction of a Distributed System. Sometimes it is better to just use traditional frameworks.
--------
Follow me to upskill in #MLOps, #MachineLearning, #DataEngineering, #DataScience and overall #Data space.
Also hit ๐to stay notified about new content.
๐๐ผ๐ปโ๐ ๐ณ๐ผ๐ฟ๐ด๐ฒ๐ ๐๐ผ ๐น๐ถ๐ธ๐ฒ ๐, ๐๐ต๐ฎ๐ฟ๐ฒ ๐ฎ๐ป๐ฑ ๐ฐ๐ผ๐บ๐บ๐ฒ๐ป๐!
Join a growing community of Data Professionals by subscribing to my ๐ก๐ฒ๐๐๐น๐ฒ๐๐๐ฒ๐ฟ: https://t.co/qgNCnGtF4A
.NET 8's dependency injection container will support "keyed services". A long-requested feature that has finally landed. This is useful when type alone isn't enough to determine the right implementation. #dotnet
@PersonalFlow_At buenas estoy sin Internet desde ayer, aunque sea tenรญa cable clรกsico hasta hace unos minutos ahora ni Internet, ni cable clรกsico ni flow. En cuanto me solucionan esto???
Este es el mejor regalo de navidad que podรญa recibir...
Mi repo de GitHub para aprender Python sigue escalando puestos en tendencias ๐ฅฐ
๐ https://t.co/d3ZAemVu07
๐ Top 8 a nivel mundial
๐ฅ Top 1 a nivel mundial de Python
๐ฅ Top 1 (2 y 5) de habla hispana
No os merezco ๐
Major new APIs in the latest daily RC1 Entity Framework Core 7 build:
ExecuteDelete - immediate non-tracking bulk delete
ExecuteUpdate - immediate non-tracking bulk update
SqlQuery<T> - ad-hoc raw SQL returning a list of scalar, simple types (classes coming in EF Core 8)
#efcore
๐งต Recursos sobre Clean Architecture/Hexagonal aplicada al Frontend con React.js
Si conoces alguno mรกs, compรกrtelo por aquรญ.
ยกAprendamos entre todos!
๐