S
Stefan Richter
Hi,
I have to write a little program,
to enter and retrieve data from a database.
The most important aspect is that the code is easy to understand, clear and
organized,
and easy to modifiy or expand.
The program won't need much data and not any complicated calculations,
so performance is less important I would say.
It will probably only be run locally on one or only a few computers,
so security should also be less important.
I did a first draft, prototyp of it, but now I would like to program it
properly.
The database will consists of 3 very small tables.
I need functions to enter, retrieve, edit and delete data,
plus validation methods of the data entered.
The display of the data should include percentages of the database values
and
a graph that shows bars representing those percentages.
So what would be the best class design?
I need functions to:
1. Validate the data entered
2. Temporarly save data
3. Databasefunctions: Select(3x), Insert(3x), Update(3x), Delete(3x)
4. Calculation of Percentages
5. Char Printing
So what would you put into seperated classes, what would you direkt handle
in a form?
Do you prefer big functions that handle everything at once
like a select method that can handle all tables, or seperated methods for
everything?
What about classes? When I temporarly save data, where would you save it?
In the Form, in a seperated database class that I also use the retrieve the
data,
or in special classes, and in that case, only one class for all the data,
or seperated classes for each of the 3 branches, or one class / function,
or, or, or????
Any help is greatly appreciated!
Thanks in advance,
Stefan
If necessary, here are further details:
3 Tables
DBT
Year
Month
Current Order
Current
30days
60days
90days
recoveries
CRS
Year
Month
Current
30days
60days
90days
insolvent
Bank
Year
Month
Opening
Receipts
Cheques
--------------------------------
functions to validate data
Validate Dbt
Validate CRS
Validate Bank
-------------------
database functions
Select:
selectDbt(month, year)
selectCRS(month, year)
selectBank(month, year)
Insert
insertDbt(month, year, current order, current, 30days, 60days, 90days,
recoveries
)
insertCRS(month, year, current, 30days, 60days, 90days, insolvent
)
insertBank(month, year, opening, receipts, cheques)
Update
selectDbt(month, year, current order, current, 30days, 60days, 90days,
recoveries)
selectCRS(month, year, current, 30days, 60days, 90days, insolvent)
selectBank(month, year, opening, receipts, cheques)
Delete
selectDbt(month, year)
selectCRS(month, year)
selectBank(month, year)
I have to write a little program,
to enter and retrieve data from a database.
The most important aspect is that the code is easy to understand, clear and
organized,
and easy to modifiy or expand.
The program won't need much data and not any complicated calculations,
so performance is less important I would say.
It will probably only be run locally on one or only a few computers,
so security should also be less important.
I did a first draft, prototyp of it, but now I would like to program it
properly.
The database will consists of 3 very small tables.
I need functions to enter, retrieve, edit and delete data,
plus validation methods of the data entered.
The display of the data should include percentages of the database values
and
a graph that shows bars representing those percentages.
So what would be the best class design?
I need functions to:
1. Validate the data entered
2. Temporarly save data
3. Databasefunctions: Select(3x), Insert(3x), Update(3x), Delete(3x)
4. Calculation of Percentages
5. Char Printing
So what would you put into seperated classes, what would you direkt handle
in a form?
Do you prefer big functions that handle everything at once
like a select method that can handle all tables, or seperated methods for
everything?
What about classes? When I temporarly save data, where would you save it?
In the Form, in a seperated database class that I also use the retrieve the
data,
or in special classes, and in that case, only one class for all the data,
or seperated classes for each of the 3 branches, or one class / function,
or, or, or????
Any help is greatly appreciated!
Thanks in advance,
Stefan
If necessary, here are further details:
3 Tables
DBT
Year
Month
Current Order
Current
30days
60days
90days
recoveries
CRS
Year
Month
Current
30days
60days
90days
insolvent
Bank
Year
Month
Opening
Receipts
Cheques
--------------------------------
functions to validate data
Validate Dbt
Validate CRS
Validate Bank
-------------------
database functions
Select:
selectDbt(month, year)
selectCRS(month, year)
selectBank(month, year)
Insert
insertDbt(month, year, current order, current, 30days, 60days, 90days,
recoveries
)
insertCRS(month, year, current, 30days, 60days, 90days, insolvent
)
insertBank(month, year, opening, receipts, cheques)
Update
selectDbt(month, year, current order, current, 30days, 60days, 90days,
recoveries)
selectCRS(month, year, current, 30days, 60days, 90days, insolvent)
selectBank(month, year, opening, receipts, cheques)
Delete
selectDbt(month, year)
selectCRS(month, year)
selectBank(month, year)