Hi,
The ultimate question is: How are classes normally structured in applications?
I am currently writing a test banking application in asp.net For example: I have these two classes. One represents an account, and the other is a utility class (It has stuff to do with accounts, i.e. getting accounts, updating accounts, etc.)
public Account {
int ID;
string Name;
double Balance;
}
public Accounts {
public List<Account> GetAllAccounts();
public Account GetAccountByID(int AccountID);
}
in my presentation layer, whenever I want to get an account I am using:
Account editAccount = new Accounts().GetAccountByID(234);
You can see I am instantiating a new Accounts() class to get an account. What should I actually be doing? Or is this correct? Does a static class fit this need better?
I feel like this is getting very cluttered and if it gets bigger it could be uncontrollable with classes having similar names.
How would you normally structure this? Do you put those two methods in the Accounts class into the Account Class?
Any insight here would be so great.
Thanks