artful at rogers.com
artful at rogers.com
Mon Mar 19 07:32:27 CDT 2007
I second that emotion, Stuart, but only halfway. If it were I, then my choice would be a trigger for updates and a pair of defaults for inserts. Concerning issues such as this, Fuller's Law is, "Whatever the back end can do, the back end should do." The Business Logic layer (IMO) is for business logic, which is to say logic that does not readily if at all conform to what is possible in the back end. For example, check constraints are sometimes insufficient weaponry to perform the given task at hand. In that case, you confront a fork in the road. You could code a sproc to do what is necessary, or you could bump the logic up to the middle-tier guys. There are advantages to both scenarios. If it's done in the business logic area, then it can be done prior to the Submit to the back end -- and the business layer can preclude unacceptable combinations of values. If it's done in the back end, the middle-tier guys may think that the problem is out of their hands, but in fact they have the responsibility to encode their Submits such that they should always work. Arthur ----- Original Message ---- From: Stuart McLachlan <stuart at lexacorp.com.pg> To: Access Developers discussion and problem solving <accessd at databaseadvisors.com> Sent: Monday, March 19, 2007 3:17:37 AM Subject: Re: [AccessD] A question of design philosophy... n-tier On 19 Mar 2007 at 17:42, Bruce Bruen wrote: > By way of example, lets say we have a business object "project" with said > audit attibutes. When an update is made to the object, i.e. the current > instance of project, say MyProject, the user can at some time update those > changes to the database. When s/he does so, the "lastChangedBy" and > "lastChangeDate" of the project needs to be updated by the system (to > "currentUser" and "now() respectively). > > So what layer should ("logically", or "architecturally" or "industry > standard" or "best practice" or....) be responsible? The BLL or the DAL? > > Your input would be appreciated - either by considered answer or by survey: > [Survey] > a) Uh???? (This is the top answer from the VB forums I use) > b) The DAL > c) The BLL > d) What does it matter, the real question is "Does it work?" > [/Survey} IMNSHO: Ideally E. The database engine itself - using triggers so that it doesn't matter how the changes are made, you always get the update. But if you are using an engine which doesn't support triggers, you need to move it back up to B. The DAL. The higher up you put it, the more complex it becomes to ensure that the updates are always applied. -- Stuart