3 Tier Architecture - In need of an example

前端 未结 9 1498
孤城傲影
孤城傲影 2020-12-12 13:53

Presently I am working using single tier architecture. Now I am wanting to learn how to write code using 3 tier architecture. Please can you provide me with a simple example

9条回答
  •  长情又很酷
    2020-12-12 14:34

    Presentation layer: put everything that is related to user interface. (What the user sees)

    Business layer: everything that is related to the logic of the application (How is the information coming from presentation layer treated)

    Data layer: provide an abstraction of the underlying data source(s) (Where and how the information coming from/going to business layer is stored)

    Each layer should know as less as possible about the other and it should be a top down approach:

    • the data layer should know nothing about business and presentation
    • business layer should know about data but not about presentation
    • presentation should know about business but not about data

    Simple example:

    Website:

    • Presentation: all the graphical things, fields where user inserts data, menus, pictures, etc.
    • Business: all constraints about the data (unique name, name without symbols, valid date, etc), methods for manipulating business objects (create new user, add new order, etc)
    • Data: Methods that access the underlying database.

提交回复
热议问题