开发者

3 Tier Architecture - data tier just stores data only? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. 开发者_开发技巧 Closed 11 years ago.

Does the data tier verify any of the user's input? or does it just store data?

Example - User adds email to his profile.

Is this right?

Presentation Tier - Verify Email format is valid (client side)

Logic tier

  • Verify Email format is valid (again?)
  • Set Email type (ie is Primary email?)
  • Check record limit allowed to store email

Data:

  • Store the email record

Logic:

  • Send Notification to presentation tier
  • Send Notification via Email


Note :

Data layer task is to connect with the database and to perform CRUD operation if you want to apply extra validation logic than you must do it in the logical layer

You architecture changes

Presentation Tier -

  • Verify Email format is valid (client side)

Logic tier

  • Verify Email format is valid (again?) - No need to do it again
  • Set Email type (ie is Primary email?)
  • Check record limit allowed to store email

Data Layer:

  • allow to connect with the database
  • perform CRUD operation

Data Store i.e DataBase

  • Store the email record

Return

DataLyer

  • Informs logic layer data inserted propertly

Logic Layer:

  • Send Notification to presentation tier either data inserted/updated properly
  • Send Notification via Email if Data Inserted/Updated properly else log error


Every layer has its own set of contracts with outside world.

You shouldn't do or not do something based on assumption that it may have been done on earlier layer (like validation)

However DataLayer doesn't verify email address formats. Its not part of its responsibilities. It shouldn't even understand what an email looks like except for a fact that it is string of some specific length.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜