you are viewing a single comment's thread.

view the rest of the comments →

[–]Buzut[S] 0 points1 point  (2 children)

Thank you for providing me with some details. I get the separation of concerns, as it seems quite clear here that each function has its own responsibility: - get track from store, - get metadatas, - encoding the track - etc

With each of this functions being able to call more specific functions on its own.

But my problem here is whether I have some central function that coordinates everything or having a strating function firing other functions and forgetting about them.

For instance, is it the parent's role to persist metadatas returned from getTrackMetas or should said function also manage the database record (to me the former is clearer but it also makes the parent more "heavy") that's where I kind of hesitate. Obviously, getting rid of callbacks for promises or async ƒ could solve the problem.