Category: Programming

UUID, ORM and strange deadlocks

Some time ago I took over the development of one module in a bigger application. The volume of requests in this module was quite small. However, I’ve noticed some strange deadlocks in logs. At first glance, the introduced models were too large, which I suspected was the source of the problems. In the case of designing models, it’s important to determine the consistency boundary at the lowest possible level to achieve business requirements. It’s needed to define where is the boundary and which data should be saved in the transaction and keep a proper balance between consistency and scalability. However, it turned out that it wasn’t the cause of deadlocks.
Read More

Poor performance of Eloquent ORM in comparison to Doctrine

In the last article, I compared two ORMs: Eloquent mostly related to Laravel, and Doctrine associated with Symfony. I presented a comparison on why reading data from the database would be much more performant using read models instead of slow ORM models with slow hydration. Read models, of course, are the best way to read data from the database, but I didn’t properly present the comparison of ORMs, which was pointed out by one user on Reddit.

Read More

Shotgun surgery: How to avoid it and achieve safety and high productivity

Imagine an engineer tasked with updating a feature who makes changes across the entire codebase without a clear plan or structure. Instead of committing small, focused updates, they introduce a massive set of changes at once, touching numerous files and modules. Without TDD or incremental commits, tracking all these modifications becomes overwhelming, making even simple tasks like code reviews or context switching costly and confusing. This disorganized approach, known as shotgun surgery, increases the likelihood of bugs and errors, making the code harder to maintain. In this article, we’ll explore how to avoid this pitfall and improve both productivity and code safety.

Read More

Container Efficiency in Modular Monoliths: Symfony vs. Laravel

In the evolving landscape of software development, modular monolith architectures have gained significant traction. This approach offers a balanced middle ground between traditional monolithic applications and microservices. However, choosing the right PHP framework for building modular monoliths is crucial, as it can have a profound impact on the application’s performance.  The container performance, which is critical for dependency injection and managing service lifecycles, varies significantly between frameworks such as Symfony and Laravel. Despite the rise of framework-agnostic practices, the reality is that switching frameworks can be prohibitively expensive. It’s crucial to make an informed decision when choosing a framework. This article explores a comparative analysis of container performance in Symfony and Laravel within modular monolith architectures, offering engineers valuable insights to guide their framework selection.

Read More

Rethinking Mocking: DIY Approach vs. Frameworks on examples in PHP and Typescript

In the landscape of software testing, the choice between a do-it-yourself (DIY) approach to mocking or utilizing mocking frameworks is a pivotal decision for programmers. While mocking is indispensable for code reliability, its overuse or incorrect implementation can introduce complexities and fragilities within test suites. This article navigates the balance between leveraging mocks effectively and avoiding common pitfalls, including the dangers of writing mocks in a suboptimal manner.

Read More

Tips for optimizing integration tests

While unit tests are known for their speed compared to integration tests, the latter offer heightened confidence in the system’s functionality. Thus, avoiding integration tests is not advisable; instead, it’s crucial to strike a balance by writing tests at an appropriate level to ensure high confidence in the codebase. Achieving this equilibrium between time efficiency and confidence is paramount. Rapid feedback is essential for a smooth workflow, and today, I’ll share concise tips to enhance the efficiency of your integration tests. The effort invested is worthwhile, as swift feedback is indispensable for seamless operations, and each minute of improvement is magnified by the frequency of executions and the number of developers in the company.

Read More