Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • 1
    What is the intended scope of EntityRepository? Is it intended to be repo for all kind of derivations of ParentEntity, knowing the whole inheritance hierarchy, or is it a repo intended just for dealing with AEntity objects? Or are you trying to implement it in a generic fashion for ParentEntitys, just in terms of virtual functions of this class? Commented Aug 2, 2021 at 12:44
  • 1
    I think you are missing something, but I don't think anyone of us can tell you exactly what, because your question is expressed in terms of the mechanics, but doesn't explain what the business problem is. 1/2 Commented Aug 2, 2021 at 20:39
  • 1
    But here are some general things you could look into, things that could be "code smells". SaveUseCase is doesn't look like a use case - it's more like a generic save service. It doesn't do anything that can be understood as meaningful on its own, it's just a data sink (single void method). Then, all it appears to do is entityRepository.save(list), so, why have the SaveUseCase class at all? Also, it's unclear why your AEntity extends ParentEntity. What is the design purpose of ParentEntity? Furthermore entities in CA are not database entities. 2/2 Commented Aug 2, 2021 at 20:39
  • 1
    @RobertBräutigam "while CA tells you explicitly that you have to start with these technicalities" - no it does not, you just read it that way. It describes a generalized way of dividing up the system; it only really asks you to separate policies by how hi-level they are. It doesn't actually prescribe the number of layers (you can have more or less), doesn't actually require you to have controllers/presenters, the "input/output data" could be data structures or parameter lists, the "interactor" could be one class or 3 classes or just a function, and "entities" are just a role. Commented Aug 3, 2021 at 19:01
  • 1
    @FilipMilovanović "It describes a generalized way of dividing up the system". This is exactly what I mean. It is not based on requirements, it is generic, i.e. technical. It defines "high" and "low" level based on whether it has anything to do with UI for example. This is also technical. A non-technical (i.e. business-relevant) division would say the "Amount" is higher level than "Balance". That is business-relevant. I'm not making a value judgement, it's just an observation. Commented Aug 4, 2021 at 7:32