I guess it was inevitable, but quite often I see homework problems on r/microservices seemingly assigned in some intro CS class. Peculiarities of that aside, they can be quite fun to work through as thought experiments. One recent one came up:
I am working on a school app. The microservices are fairly obvious, e.g. teacher, student, etc.
However, one thing I have found is that it is impossible to seperate databases. For example, there are relationships amongst teachers, students, rooms, etc.
So I'd have one big database but seperate microservices, or is there another way to tackle this?
This highlights a very common mistake I see when folks try to carve out service boundaries, especially from a naive outsider perspective. The business domain here is "school app", but no description on what the app actually needs to do. The microservices are "fairly obvious", being "teacher, student, etc."
Already we see the mistake - building service boundaries around the "nouns" in our business domain. But that way lies madness, it will produce designs where we're trying to do SQL joins via web API calls. I said as much in my reply to designing the boundaries:
Imagine how a business or the school administration would organize themselves into departments etc. That’s a great first attempt into defining your boundaries. Not nouns or concepts, that way leads madness (and doing DB joins via API calls).
Service boundaries are ownership boundaries of information, policies, communication, and interactions. There are more technical concerns too but that’s how I like to think of them.
From the outside it's quite challenging to understand how the business organizes itself internally. That's why it's so critical to have those conversations and design sessions with domain and business experts. It's usually by design we don't know how the sausage is made. But it if you want to successfully design service boundaries, you have to tour the sausage factory.
In the school case, I'd talk to school administrators to understand the business of running a university. I'd track how the administrative departments are delineated, what responsibilties each have, how and when each they communicate, for what workflows, and so on. It can be complicated and complex, and I'll often get "sorry this must be boring" from the domain experts, but it's only through this deeper analysis we'll get the insight into the "how".
Which makes this quite silly as a homework problem, my first task would be to schedule time with the professor to interview them on how a school "schools".