BLL, DAL, OBJ and 3 layer architecture

前端 未结 2 1119
野性不改
野性不改 2020-12-18 06:54

My question is about 3 layer architecture.

My project is briefly something like the below, however what annoyed me is after I insert a new column inside my database,

2条回答
  •  没有蜡笔的小新
    2020-12-18 07:29

    1. DA Objects should represent your database schema in some way and should be strictly binded to the Database activity.

    2. Business layer this is place where you should manipulate with data using specific to your project logic. Your business object not always is the same as DA Object (please imagine DA object with two properties Forename and Surname, but because of some reasons your BO object has only one property Surname because Forename is never used in logic. When business change their minds and they want to manipulate with Forename too, you have to add it only in this layer).

    3. Presentation layer objects should be strictly binded to the views. There shouldn't be any logic. These objects should be used only for displaying activities.

    When you try to keep this rules code it's much more clear and easy to maintain not only for you but especially for your team-mates. It's easier to extend well separated code.

    Please also remember that in some cases for example in projects which are using web services can be implemented fourth layer with Service Oriented Objects.

提交回复
热议问题