PDA

Click to See Complete Forum and Search --> : Architecture discussion anyone?


Tal McMahon
May 23rd, 2003, 10:01 AM
Hello all, have been .netting for a while now and am starting to get the idea of classing out things and now I have a question.

Please feel free to comment or add any thoughts about the following.

My basic architectural belief is:

for the GUI,
The Gui forms should know little or nothing about the data they display. That is to say if I have for instance a form for "New Employees" the validation of the FirstName field should be a function of a class "employee" the GUI should just reference it and let the class do the testing.

For the Class,
The class should Know all of the data it contains and how to retrieve it from the database. The Class validates the data, gets the data etc.

for the DataBase
The Database only Presents the data. it does not do anything to the data for the gui. for example if you have a dropdown that you want to populate and you want the first row to be called "Select a department" you would NOT program it into the SQL procedule with a union. you would instead program it at the gui level.


Does this sound like the right direction or am I way off base?

any comments would be welcomed


Tal McMahon

nswan
May 23rd, 2003, 10:29 AM
sounds good to me. this is the way i've been trying to head as well.
You could have a data access class as well where the class that does all the validation passes the dataset to the data access class and it is this classes job for doing the reading writing to the database.

Tal McMahon
May 23rd, 2003, 10:32 AM
O.K.

so your saying have a class for example "Employee" that does the Employee Stuff data wise. Then have another Class Like "EmployeeDataBaseConnection" that would have Add, get, delete and edit type methods for database interaction.

cool.

tal

nswan
May 23rd, 2003, 10:36 AM
sounds about right. It's more something i've read about than implemented at the moment but i will be looking at doing it myself in the not to distant future.

Tal McMahon
May 23rd, 2003, 10:39 AM
O.k.

Then would you implement it on a single record basis (i.e. newEmployee.add) Or would you then build a collection of employees and at the end of the session do a bulk insert ?

tal

nswan
May 23rd, 2003, 10:42 AM
are you using datasets? then you can update them when you have finished editing/adding using the dataAdapter and command builder.

Tal McMahon
May 23rd, 2003, 10:47 AM
Wan't really looking at at the How to part of this. I figure I could use a dataset if I wanted to do multiple insertions or I would just use a single cmd if it was singletons.

tal

nswan
May 23rd, 2003, 10:50 AM
all depends which way you want to program it. Don't think there is a right or wrong answer. Just depends i suppose on whether you will be pulling large datasets(in terms of number of records) from the database. If you are then it would be better looking at doing it one by one.