Software Engineering
Problem : Tight coupling leads to fragility - a change in one microservice breaks connected services.
Low cohesion results in unclear responsibilities.
Low cohesion results in unclear responsibilities.
- Solution : Apply loose coupling and high cohesion. In a loosely coupled system, each component is independent and changes in one will not affect the others. High cohesion means that each component i
Muaath Bin Ali • Microservices Design Principles
- Tornado is a Python web framework and asynchronous networking library designed for handling long-lived network connections. It is built to be non-blocking and uses an event loop to manage all operations. While Tornado itself does not rely on a thread pool for its core operations, it provides interfaces for integrating with thread pools (e.g., conc
Saverio Mazza • FastAPI: Thread Pool and Event Loop
Each log message in the system should be unique.
If I query for a log in a specfic service, I will be confused to see the exact same logs at different flows inside the service.
More than that, I’ll just have to start debugging for the issue, since the logs are now offically useless.
One way to keep the logs unique is to denote the service name and fu... See more
If I query for a log in a specfic service, I will be confused to see the exact same logs at different flows inside the service.
More than that, I’ll just have to start debugging for the issue, since the logs are now offically useless.
One way to keep the logs unique is to denote the service name and fu... See more
Logging practices I follow
- Terraform Providers: Terraform is primarily used for defining the infrastructure resources. Its strength lies in its vast collection of providers that offer standardized ways to interact with various cloud services (AWS, Azure, GCP, etc.) and on-premises infrastructure. These providers are essentially plugins that understand the specific APIs and
Gemini - chat to supercharge your ideas
A thread pool is a collection of pre-initialized threads that can be used to execute tasks. Instead of starting a new thread for each task (which can be resource-intensive), a thread from this pool is reused to perform the task. This approach is beneficial for handling multiple operations in parallel, especially when these operations are blocking a... See more
Saverio Mazza • FastAPI: Thread Pool and Event Loop
Using feature flags
It's always a good idea to put new features behind a feature flag.
This contributes to a rollout strategy that can surface user feedback in a much more contained and safe environment.
When thinking about how to rollout a new feature to users, first think about your peers. Many of the Resend team members also use Resend on their ow... See more
It's always a good idea to put new features behind a feature flag.
This contributes to a rollout strategy that can surface user feedback in a much more contained and safe environment.
When thinking about how to rollout a new feature to users, first think about your peers. Many of the Resend team members also use Resend on their ow... See more
How we ship new features · Resend
The book Clean Code introduces three laws of TDD [1]:
So, the tests are written before the production code. This leads to the developer ... See more
- Write a failing unit test first before you start writing production code.
- Write not more of a unit test than is sufficient to fail.
- Write not more production code than is sufficient to pass the currently failing test.
So, the tests are written before the production code. This leads to the developer ... See more
How to Write Clean Code in Python
Use nested objects for future extensibility
A follow on from the previous tip: try to logically group fields together. The following:
customer.address = {
line1: "Main Street 123",
city: "San Francisco",
postal_code: "12345"
};
Enter fullscreen mode
Exit fullscreen mode
is much cleaner than:
customer.address_line1 = "Main street 123";
customer.address_city... See more
A follow on from the previous tip: try to logically group fields together. The following:
customer.address = {
line1: "Main Street 123",
city: "San Francisco",
postal_code: "12345"
};
Enter fullscreen mode
Exit fullscreen mode
is much cleaner than:
customer.address_line1 = "Main street 123";
customer.address_city... See more
Common Design Patterns at Stripe
To make life for developers easier, be explicit in what exactly is being returned. In the Stripe API, we have an object field in the response that makes it abundantly clear what we’re working with. For example, the API route
/v1/customers/:customer/payment_methods/:payment_method
Enter fullscreen mode
Exit fullscreen mode
returns a PaymentMethod atta... See more
/v1/customers/:customer/payment_methods/:payment_method
Enter fullscreen mode
Exit fullscreen mode
returns a PaymentMethod atta... See more