Sign in

Architect, Developer, Software Engineer

Some time ago, I wrote about Ports and Adapters architecture, where domain logic is completely separated from infrastructure logic, like database connection, rest controllers, clients etc. It is great if you have external dependencies, and you want to just test your domain logic without the need for low-level mocking of dependencies. But what if you have a single codebase, a monolith app? Is it useful here? The TL;DR answer is… YES. Here’s why.

The standard approach

The standard way of writing software in a layered manner is to use an interface for some kind of service, with the defined API of this service…


Documentation is important, everybody knows this, especially when you are the one who needs to use some third-party service or library. Without good documentation it’s often a living hell, it’s like walking through a minefield. You carefully take step after step, praying that things won’t blow up. That’s why you HAVE to create documentation, especially for your libraries and REST services. Another important thing about documentation is that you have to update it whenever code changes because the only worse thing than no documentation is wrong documentation, a documentation that is not valid for the current code base.

So if…


Creating REST endpoints has become pretty popular. All these microservices, APIs, simple backend applications for the frontend javascript apps often use REST for communication. But sometimes, requests that are made toward them may have errors. Bad format, missing required values, missing properties. How to handle it? Let’s see.

All the above errors are pretty simple most of the time, but nevertheless, they can cause trouble in the business logic and we have to protect our services from them. The best solution here is to fail fast, that is to validate the request as soon as possible, check everything we can…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store