FarligOpptreden
Executive Member
That sounds like a maintenance nightmare. You've created a direct dependency between your database and your user interface, change one and you have to go change the other as well.
When I design systems, I start by designing the data model to suit the business domain (not the user interface). If you design the data model to match the UI, then you've created a dependency between the two.
Step 1 for me is to design the data model. Once I've got the data model to accurately represent the business domain, then I give it to the programmer and let him go wild with it. He can design the UI with as many bells and whistles as he wants, but he has to work to the data model that he has been given.
Of course there's going to be redundancy in any given UI representation of the data, but data model will always be an accurate representation of the business domain even though the UI may choose not to display all the data it's been given.
That gives you the flexibility to design various UI's using different delivery platforms without having to redesign the data model for each platform. So there is never a dependency between the UI and the data.
Well, strokes and folks, you know? In my case, the data model that is returned to the "code" is derived from a single or set of data views. By using dynamic SQL in all my stored procedures (sp_ExecuteSql), I can filter the results of my views by just about any parameter(s) passed through to the SP. 99% of the times the SP returns a simple "select * from vw_VIEWNAME where 1=1" with a bunch of extra where-clauses, depending on which parameters passed through are NOT NULL. The fields that are returned are then just changed in the view.
The philosophy at our company is to do as much as possible on the database side and leave the code to facilitate interaction between the database and the UI. Our "business layer" consists of objects representing the necessary business rules and entities, which are then used in the presentation tier to facilitate user interaction with the data.