Size is important

We all know the saying it is that you know what to do with it. Well it seems in development world the size is not the bigger the better but everything has to be as tiny as possible; from silicon chips to frameworks. Also they have no idea how to use it and what to do with it.

Service Oriented Architecture

In the last years it has become common to fall for the new trend called micro services. Which is just Service Oriented Architecture. It states that there should be no big monolith that has all the code in one application but divvy up the logic to individual services. Just like in the monolithic code but now also actually deployed on their own infrastructure. This seems nice on paper, but really it is a nightmare to maintain.

I speak from experience. A simple app we set out to make. Nothing fancy, nothing special. It was turning into something so complex so fast because the problem is a lot of things are shared across these services. For instance the database model is shared. They all need to work with the same data at some point. If all the services are stateless and get all the known information in the request then that is complex. Now you have to send the full context everywhere. This results in duplication of processing logic. So either you duplicate the shared code for models or you duplicate the shared logic for processing. Or you have a middleware that handles all the messaging and transforms and enriches them all. Or just a monolith that has all the context.

Now one architecture I am in favour of is the hybrid model. You have a monolith but some parts that can exist outside of the monolith (like file processing perhaps) will be turned into a separate service.

Frontend here we come

That was all just for the backend world. Me and a colleague made a joke a couple of months ago, it was about making micro frontends. Well guess the joke is on us, because that is a thing now. Why on Earth do you wish to have micro frontends? The frontend framework eco system is already complex enough as it is. You can already be a dedicated Angular developer for example. Why add the unnecessary complexity of divvying up the logic or even worse run multiple frameworks together?

I mean why stop there frontend, take it further I would say. The size rule states we need to go smaller and smaller. So I say nano frontends.

Nano

The nano services are just always one function exported. It takes one input and generates one output and that is it. No more then one function. Also HTML will be no more than one tag so lots of templates need to be stitched together. CSS the same, no more than one selector per file.

Pico

The nano services are too big. We need pico services. One function is too much, it cannot be more than one line. If it does not fit on one line, then multiple pico services need to be stitched together with a nano service.

Femto

The pico services are too big still. We need femto services. One line is too much. It can only be one character in a file and that is it.

Atto

The femto services are too big still. We need atto services. One character is too much. It can only hold a 1 or a 0 and that is it.

#devlife #devops