Program Design - Package by Feature vs. Layer or Both?

前端 未结 3 419
暗喜
暗喜 2020-12-05 16:18

I am in the design stage of a web application that allows users to create requests of work and the workers to put time against those requests. The application will also have

3条回答
  •  一向
    一向 (楼主)
    2020-12-05 16:54

    I would suggest to start package things based on business entities. And in there you can divide things based on layers.

    With all of the overlap is this really functional?

    I am practising it for long. I don't see any major issues with this approach. You must find out what to decouple and how much it should be decoupled. For example, calling a persistent method of orders from a customer package using the API provided by orders is pretty fine for me.

    What are the pros and cons to using package by feature?

    I find it more simple, straight, understandable and easy to work with than strict layer oriented packaging. It benefits when you want to split and distribute things to different places.

    Would it be good design to go with an additional persistence layer?

    Look at this SO thread, I found JPA, or alike, don't encourage DAO pattern.

    Further Reading

    • Generic Repository and DDD

提交回复
热议问题