GrapesGoober / des424-g11-todo-cards

0 stars 0 forks source link

Design Code Responsibility Without Circular Import #7

Closed GrapesGoober closed 1 week ago

GrapesGoober commented 1 week ago

Problem

Good rule of thumb is that each service should follow one single responsibility. However, we need ways to address the problem when one service needs functionality of another. The easy way is to just import another service, but that can lead to circular import. How can we design a solution that prevents this?

Might be helpful to look into previous ToDoCards project, see how it's done.

GrapesGoober commented 1 week ago

Nevermind

As Kram pointed out, there aren't many cases where one service needs to write to another database. The simplest solution is to allow arbitrary read pattern (SELECT) but be very careful of write (INSERTS).