mardi 14 février 2017

Entities Reltions and Service api

I have such relations between entities:

class FooParent{
  private Collection<FooChild> fooChilldren;
}

class FooChild{
  private FooParent;
}

Obviously my services will contain methods look like:

class FooParentService{
  Collection<FooChild> getChilldrenForParrent(parentId);
}

and

class FooChildService{
  Collection<FooChild> getChilldrenForParrent(parentId);
}

So the question is: wich aproach is better? Mayby i should have both? I know that it's an opinion-bassed question, but your opinion is EXACTLY what I would like to know to get my decision. My app's design depends on it. In the first case i get to many "strange" repositories in ParrentService, but in the second case i get to many "strange" services in ParrentController.

Aucun commentaire:

Enregistrer un commentaire