Creating A Loosely-Coupled / Scalable software architecture

前端 未结 4 899
[愿得一人]
[愿得一人] 2021-01-02 19:38

I\'ve been researching this for weeks. I\'m currently designing a loosely-coupled architecture design using n-tier (3-layered) method and factory design ap

4条回答
  •  盖世英雄少女心
    2021-01-02 20:25

    You've got a basic violation of Separation of Concerns/Single Responsibility Principle: Your business objects know about their storage.

    The Data Layer of the 3-tier architecture should be responsible for CRUD operations, and should be queried for instances of the objects consumers need. Something like this:

    Presentation Layer ------- Data Layer
                                  ||
                                  ||
                           Business Layer
    

    This allows the business layer to focus on implementing, and keeps the persistence concerns out of it. If the Presentation layer needs a new business object (for creation), it asks the data layer for it.

提交回复
热议问题